home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / EMULATOR / GBDK_BIN / !GBDK / docs / asmlnk next >
Text File  |  1996-04-05  |  143KB  |  4,244 lines

  1.  
  2.  
  3.          
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                                 ASxxxx Assemblers
  27.  
  28.  
  29.                                        and
  30.  
  31.  
  32.                             ASLINK Relocating Linker
  33. CHAPTER 1  THE ASSEMBLER                                 1-1 
  34.   1.1     THE ASXXXX ASSEMBLERS                          1-1 
  35.   1.1.1     Assembly Pass 1                              1-2 
  36.   1.1.2     Assembly Pass 2                              1-2 
  37.   1.1.3     Assembly Pass 3                              1-2 
  38.   1.2     SOURCE PROGRAM FORMAT                          1-3 
  39.   1.2.1     Statement Format                             1-3 
  40.   1.2.1.1     Label Field                                1-3 
  41.   1.2.1.2     Operator Field                             1-5 
  42.   1.2.1.3     Operand Field                              1-5 
  43.   1.2.1.4     Comment Field                              1-6 
  44.   1.3     SYMBOLS AND EXPRESSIONS                        1-6 
  45.   1.3.1     Character Set                                1-6 
  46.   1.3.2     User-Defined Symbols                        1-10 
  47.   1.3.3     Local Symbols                               1-11 
  48.   1.3.4     Current Location Counter                    1-12 
  49.   1.3.5     Numbers                                     1-14 
  50.   1.3.6     Terms                                       1-14 
  51.   1.3.7     Expressions                                 1-15 
  52.   1.4     GENERAL ASSEMBLER DIRECTIVES                  1-16 
  53.   1.4.1     .module Directive                           1-16 
  54.   1.4.2     .title Directive                            1-17 
  55.   1.4.3     .sbttl Directive                            1-17 
  56.   1.4.4     .page Directive                             1-17 
  57.   1.4.5     .byte and .db Directives                    1-17 
  58.   1.4.6     .word and .dw Directives                    1-18 
  59.   1.4.7     .blkb, .blkw, and .ds Directives            1-18 
  60.   1.4.8     .ascii Directive                            1-18 
  61.   1.4.9     .asciz Directive                            1-19 
  62.   1.4.10    .radix Directive                            1-19 
  63.   1.4.11    .even Directive                             1-20 
  64.   1.4.12    .odd Directive                              1-20 
  65.   1.4.13    .area Directive                             1-20 
  66.   1.4.14    .org Directive                              1-22 
  67.   1.4.15    .globl Directive                            1-22 
  68.   1.4.16    .if, .else, and .endif Directives           1-23 
  69.   1.4.17    .include Directive                          1-24 
  70.   1.4.18    .setdp Directive                            1-24 
  71.   1.5     INVOKING ASXXXX                               1-26 
  72.   1.6     ERRORS                                        1-27 
  73.   1.7     LISTING FILE                                  1-28 
  74.   1.8     SYMBOL TABLE FILE                             1-30 
  75.   1.9     OBJECT FILE                                   1-30 
  76.  
  77. CHAPTER 2  THE LINKER                                    2-1 
  78.   2.1     ASLINK RELOCATING LINKER                       2-1 
  79.   2.2     INVOKING ASLINK                                2-2 
  80.   2.3     ASLINK PROCESSING                              2-3 
  81.   2.4     LINKER INPUT FORMAT                            2-4 
  82.   2.4.1     Object Module Format                         2-5 
  83.   2.4.2     Header Line                                  2-5 
  84.   2.4.3     Module Line                                  2-5 
  85.   2.4.4     Symbol Line                                  2-5 
  86.   2.4.5     Area Line                                    2-6 
  87.   2.4.6     T Line                                       2-6 
  88.   2.4.7     R Line                                       2-6 
  89.   2.4.8     P Line                                       2-7 
  90.   2.5     LINKER ERROR MESSAGES                          2-7 
  91.                                                      Page ii
  92.  
  93.  
  94.  
  95. CHAPTER 3  BUILDING ASXXXX AND ASLINK                    3-1 
  96.   3.1     BUILDING AN ASSEMBLER                          3-1 
  97.   3.2     BUILDING ASLINK                                3-2 
  98.  
  99. APPENDIX A  AS6800 ASSEMBLER                             A-1 
  100.   A.1     6800 REGISTER SET                              A-1 
  101.   A.2     6800 INSTRUCTION SET                           A-1 
  102.   A.2.1     Inherent Instructions                        A-2 
  103.   A.2.2     Branch Instructions                          A-2 
  104.   A.2.3     Single Operand Instructions                  A-3 
  105.   A.2.4     Double Operand Instructions                  A-4 
  106.   A.2.5     Jump and Jump to Subroutine Instructions     A-4 
  107.   A.2.6     Long Register Instructions                   A-5 
  108.  
  109. APPENDIX B  AS6801 ASSEMBLER                             B-1 
  110.   B.1     .hd6303 DIRECTIVE                              B-1 
  111.   B.2     6801 REGISTER SET                              B-1 
  112.   B.3     6801 INSTRUCTION SET                           B-1 
  113.   B.3.1     Inherent Instructions                        B-2 
  114.   B.3.2     Branch Instructions                          B-2 
  115.   B.3.3     Single Operand Instructions                  B-3 
  116.   B.3.4     Double Operand Instructions                  B-4 
  117.   B.3.5     Jump and Jump to Subroutine Instructions     B-5 
  118.   B.3.6     Long Register Instructions                   B-5 
  119.   B.3.7     6303 Specific Instructions                   B-5 
  120.  
  121. APPENDIX C  AS6804 ASSEMBLER                             C-1 
  122.   C.1     6804 REGISTER SET                              C-1 
  123.   C.2     6804 INSTRUCTION SET                           C-1 
  124.   C.2.1     Inherent Instructions                        C-2 
  125.   C.2.2     Branch Instructions                          C-2 
  126.   C.2.3     Single Operand Instructions                  C-2 
  127.   C.2.4     Jump and Jump to Subroutine Instructions     C-2 
  128.   C.2.5     Bit Test Instructions                        C-2 
  129.   C.2.6     Load Immediate data Instruction              C-3 
  130.   C.2.7     6804 Derived Instructions                    C-3 
  131.  
  132. APPENDIX D  AS6805 ASSEMBLER                             D-1 
  133.   D.1     6805 REGISTER SET                              D-1 
  134.   D.2     6805 INSTRUCTION SET                           D-1 
  135.   D.2.1     Control Instructions                         D-2 
  136.   D.2.2     Bit Manipulation Instructions                D-2 
  137.   D.2.3     Branch Instructions                          D-2 
  138.   D.2.4     Read-Modify-Write Instructions               D-3 
  139.   D.2.5     Register\Memory Instructions                 D-3 
  140.   D.2.6     Jump and Jump to Subroutine Instructions     D-4 
  141.  
  142. APPENDIX E  AS6809 ASSEMBLER                             E-1 
  143.   E.1     6809 REGISTER SET                              E-1 
  144.   E.2     6809 INSTRUCTION SET                           E-1 
  145.   E.2.1     Inherent Instructions                        E-3 
  146.   E.2.2     Short Branch Instructions                    E-3 
  147.   E.2.3     Long Branch Instructions                     E-3 
  148.   E.2.4     Single Operand Instructions                  E-4 
  149.                                                     Page iii
  150.  
  151.  
  152.  
  153.   E.2.5     Double Operand Instructions                  E-5 
  154.   E.2.6     D-register Instructions                      E-5 
  155.   E.2.7     Index/Stack Register Instructions            E-5 
  156.   E.2.8     Jump and Jump to Subroutine Instructions     E-6 
  157.   E.2.9     Register - Register Instructions             E-6 
  158.   E.2.10    Condition Code Register Instructions         E-6 
  159.   E.2.11    6800 Compatibility Instructions              E-6 
  160.  
  161. APPENDIX F  AS6811 ASSEMBLER                             F-1 
  162.   F.1     6811 REGISTER SET                              F-1 
  163.   F.2     6811 INSTRUCTION SET                           F-1 
  164.   F.2.1     Inherent Instructions                        F-2 
  165.   F.2.2     Branch Instructions                          F-2 
  166.   F.2.3     Single Operand Instructions                  F-3 
  167.   F.2.4     Double Operand Instructions                  F-4 
  168.   F.2.5     Bit Manupulation Instructions                F-4 
  169.   F.2.6     Jump and Jump to Subroutine Instructions     F-5 
  170.   F.2.7     Long Register Instructions                   F-5 
  171.  
  172. APPENDIX G  AS8085 ASSEMBLER                             G-1 
  173.   G.1     8085 REGISTER SET                              G-1 
  174.   G.2     8085 INSTRUCTION SET                           G-1 
  175.   G.2.1     Inherent Instructions                        G-2 
  176.   G.2.2     Register/Memory/Immediate Instructions       G-2 
  177.   G.2.3     Call and Return Instructions                 G-2 
  178.   G.2.4     Jump Instructions                            G-2 
  179.   G.2.5     Input/Output/Reset Instructions              G-3 
  180.   G.2.6     Move Instructions                            G-3 
  181.   G.2.7     Other Instructions                           G-3 
  182.  
  183. APPENDIX H  ASZ80 ASSEMBLER                              H-1 
  184.   H.1     .hd64 DIRECTIVE                                H-1 
  185.   H.2     Z80 REGISTER SET AND CONDITIONS                H-1 
  186.   H.3     Z80 INSTRUCTION SET                            H-2 
  187.   H.3.1     Inherent Instructions                        H-3 
  188.   H.3.2     Implicit Operand Instructions                H-3 
  189.   H.3.3     Load Instruction                             H-4 
  190.   H.3.4     Call/Return Instructions                     H-4 
  191.   H.3.5     Jump and Jump to Subroutine Instructions     H-4 
  192.   H.3.6     Bit Manipulation Instructions                H-5 
  193.   H.3.7     Interrupt Mode and Reset Instructions        H-5 
  194.   H.3.8     Input and Output Instructions                H-5 
  195.   H.3.9     Register Pair Instructions                   H-5 
  196.   H.3.10    HD64180 Specific Instructions                H-6 
  197.  
  198.  
  199.                                                                  Page iv
  200.         
  201.  
  202.  
  203.          
  204.  
  205.  
  206.  
  207.  
  208.  
  209.                                   P R E F A C E
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.            The  ASxxxx  assemblers  were  written following the style of
  217.         several cross assemblers found in the Digital Equipment Corpora-
  218.         tion  Users  Society  (DECUS)  distribution of the C programming
  219.         language.  The DECUS code was provided with no documentation  as
  220.         to  the  input  syntax  or the output format.  Study of the code
  221.         revealed that the unknown author of the code  had  attempted  to
  222.         formulate  an assembler with attributes similiar to those of the
  223.         PDP-11 MACRO assembler (without macro's).  The  incomplete  code
  224.         from  the  DECUS C distribution has been largely rewritten, only
  225.         the program structure, and C source  file  organization  remains
  226.         relatively  unchanged.   However, I wish to thank the author for
  227.         his contribution to this set of assemblers.  
  228.  
  229.            The  ASLINK  program was written as a companion to the ASxxxx
  230.         assemblers, its design and implementation was not  derived  from
  231.         any other work.  
  232.  
  233.            The  ASxxxx  assemblers  and the ASLINK relocating linker are
  234.         placed in the Public Domain.   Publication  or  distribution  of
  235.         these programs for non-commercial use is hereby granted with the
  236.         stipulation that the  copyright  notice  be  included  with  all
  237.         copies.  
  238.  
  239.            I  would  greatly  appreciate  receiving  the  details of any
  240.         changes, additions, or errors pertaining to these  programs  and
  241.         will  attempt  to  incorporate  any  fixes  or  generally useful
  242.         changes in a future update to these programs.  
  243.  
  244.  
  245.  
  246.  
  247.                        Alan R.  Baldwin 
  248.                        Kent State University 
  249.                        Physics Department 
  250.                        Kent, Ohio 44242 
  251.  
  252.  
  253.          
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                         C H A N G E S   I N   V 0 1 . 5 0
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.            The  ASxxxx  assembler  and  linker have been updated to move
  267.         byte index, direct page  mode,  and  byte  pc  relative  address
  268.         checking  from the assembler to the linker.  This change has al-
  269.         lowed the following enhancements:  
  270.  
  271.              1.  The  .setdp  directive  now has a common format for all
  272.                  AS68xx assemblers.  
  273.  
  274.              2.  Direct  page  variables  may be externally defined with
  275.                  their addresses resolved at link time.  
  276.  
  277.              3.  Byte  index  offsets  may  be  external  references and
  278.                  resolved at link time.  
  279.  
  280.              4.  Byte  pc  relative  instructions  (i.e.   branches) may
  281.                  reference external labels or labels in other areas.  
  282.  
  283.  
  284.            The  ASxxxx  assemblers  (using  the  -f  or  -ff option) can
  285.         generate a listing file which flags the data that will be  relo-
  286.         cated by the linker.  
  287.  
  288.            The  REL file format now has an additional directive for pag-
  289.         ing information and has additional flags for  page0,  page,  and
  290.         unsigned  byte  formats.   The new linker is compatible with the
  291.         first version of the ASxxxx assemblers.  
  292.  
  293.            The  remaining changes are related to non-portable code found
  294.         while porting the assemblers to a motorola 68030 system.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.                                     CHAPTER 1
  310.  
  311.                                   THE ASSEMBLER
  312.  
  313.  
  314.  
  315.  
  316.  
  317.         1.1  THE ASXXXX ASSEMBLERS 
  318.  
  319.  
  320.            The  ASxxxx  assemblers are a series of microprocessor assem-
  321.         blers written in the C programming language.  Each assembler has
  322.         a device specific section which includes:  
  323.  
  324.              1.  device  description, byte order, and file extension in-
  325.                  formation 
  326.  
  327.              2.  a  table  of  the assembler general directives, special
  328.                  device directives, assembler mnemonics  and  associated
  329.                  operation codes 
  330.  
  331.              3.  machine specific code for processing the device mnemon-
  332.                  ics, addressing modes, and special directives 
  333.  
  334.         The device specific information is detailed in the appendices.  
  335.  
  336.            The assemblers have a common device independent section which
  337.         handles the details of file input/output, symbol  table  genera-
  338.         tion,  program/data  areas,  expression  analysis, and assembler
  339.         directive processing.  
  340.  
  341.         The assemblers provide the following features:  
  342.  
  343.              1.  Command string control of assembly functions 
  344.  
  345.              2.  Alphabetized, formatted symbol table listing 
  346.  
  347.              3.  Relocatable object modules 
  348.  
  349.              4.  Global symbols for linking object modules 
  350.  
  351.              5.  Conditional assembly directives 
  352.  
  353.  
  354.  
  355.         THE ASSEMBLER                                           PAGE 1-2
  356.         THE ASXXXX ASSEMBLERS
  357.  
  358.  
  359.              6.  Program sectioning directives 
  360.  
  361.  
  362.            ASxxxx assembles one or more source files into a single relo-
  363.         catable ascii object file.  The output of the ASxxxx  assemblers
  364.         consists of an ascii relocatable object file(*.rel), an assembly
  365.         listing file(*.lst), and a symbol file(*.sym).  
  366.  
  367.  
  368.         1.1.1  Assembly Pass 1 
  369.  
  370.  
  371.            During  pass  1, ASxxxx opens all source files and performs a
  372.         rudimenatry assembly of each source statement.  During this pro-
  373.         cess  all symbol tables are built, program sections defined, and
  374.         number of bytes for each assembled source line is estimated.  
  375.  
  376.            At the end of pass 1 all undefined symbols may be made global
  377.         (external) using the ASxxxx switch -g, otherwise undefined  sym-
  378.         bols will be flagged as errors during succeeding passes.  
  379.  
  380.  
  381.         1.1.2  Assembly Pass 2 
  382.  
  383.  
  384.            During  pass  2  the ASxxxx assembler resolves forward refer-
  385.         ences and determines the number  of  bytes  for  each  assembled
  386.         line.   The  number  of bytes used by a particular assembler in-
  387.         struction may depend upon the addressing mode, whether  the  in-
  388.         struction allows multiple forms based upon the relative distance
  389.         to the addressed location, or other factors.   Pass  2  resolves
  390.         these cases and determines the address of all symbols.  
  391.  
  392.  
  393.         1.1.3  Assembly Pass 3 
  394.  
  395.  
  396.            Pass 3 by the assembler generates the listing file, the relo-
  397.         catable output file, and the symbol tables.  Also during pass  3
  398.         the errors will be reported.  
  399.  
  400.            The  relocatable object file is an ascii file containing sym-
  401.         bol references and definitions, program  area  definitions,  and
  402.         the  relocatable assembled code, the linker ASLINK will use this
  403.         information to generate an absolute load file (Motorola or Intel
  404.         formats).  
  405.  
  406.  
  407.  
  408.  
  409.         THE ASSEMBLER                                           PAGE 1-3
  410.         SOURCE PROGRAM FORMAT
  411.  
  412.  
  413.         1.2  SOURCE PROGRAM FORMAT 
  414.  
  415.  
  416.  
  417.         1.2.1  Statement Format 
  418.  
  419.  
  420.            A source program is composed of assembly-language statements.
  421.         Each statement must be completed on one line.  A line  may  con-
  422.         tain a maximum of 128 characters, longer lines are truncated and
  423.         lost.  
  424.  
  425.            An  ASxxxx  assembler  statement  may  have  as  many as four
  426.         fields.  These fields are identified by their order  within  the
  427.         statement  and/or  by separating characters between fields.  The
  428.         general format of the ASxxxx statement is:  
  429.  
  430.               [label:]  Operator        Operand         [;Comment(s)] 
  431.  
  432.            The  label and comment fields are optional.  The operator and
  433.         operand fields are interdependent.  The operator field may be an
  434.         assembler  directive or an assembly mnemonic.  The operand field
  435.         may be optional or required as defined in  the  context  of  the
  436.         operator.  
  437.  
  438.            ASxxxx  interprets  and  processes source statements one at a
  439.         time.  Each statement causes a particular operation to  be  per-
  440.         formed.  
  441.  
  442.  
  443.         1.2.1.1  Label Field  - 
  444.  
  445.            A  label is a user-defined symbol which is assigned the value
  446.         of the current location counter and entered into  the  user  de-
  447.         fined  symbol  table.   The  current location counter is used by
  448.         ASxxxx to assign memory addresses to the source  program  state-
  449.         ments as they are encountered during the assembly process.  Thus
  450.         a label is a means  of  symbolically  referring  to  a  specific
  451.         statement.  
  452.  
  453.            When  a program section is absolute, the value of the current
  454.         location counter is absolute;  its value references an  absolute
  455.         memory  address.   Similarly, when a program section is relocat-
  456.         able, the value of the current location counter is  relocatable.
  457.         A  relocation  bias  calculated at link time is added to the ap-
  458.         parent value of the current location counter  to  establish  its
  459.         effective  absolute  address  at  execution time.  (The user can
  460.         also force the linker to relocate sections defined as  absolute.
  461.         This may be required under special circumstances.) 
  462.  
  463.            If  present,  a  label  must  be  the first field in a source
  464.         statement and must be terminated by a colon (:).   For  example,
  465.  
  466.  
  467.         THE ASSEMBLER                                           PAGE 1-4
  468.         SOURCE PROGRAM FORMAT
  469.  
  470.  
  471.         if  the  value  of  the  current  location  counter  is absolute
  472.         01F0(H), the statement:  
  473.  
  474.               abcd:     nop 
  475.  
  476.         assigns  the  value  01F0(H) to the label abcd.  If the location
  477.         counter value were relocatable, the final value of abcd would be
  478.         01F0(H)+K, where K represents the relocation bias of the program
  479.         section, as calculated by the linker at link time.  
  480.  
  481.            More  than  one label may appear within a single label field.
  482.         Each label so specified is assigned the same address value.  For
  483.         example,  if  the  value  of  the  current  location  counter is
  484.         1FF0(H), the multiple labels in the following statement are each
  485.         assigned the value 1FF0(H):  
  486.  
  487.               abcd:     aq:     $abc:   nop 
  488.  
  489.            Multiple labels may also appear on successive lines.  For ex-
  490.         ample, the statements 
  491.  
  492.               abcd:  
  493.               aq:  
  494.               $abc:     nop 
  495.  
  496.         likewise  cause  the  same value to be assigned to all three la-
  497.         bels.  
  498.  
  499.            A  double  colon  (::)  defines the label as a global symbol.
  500.         For example, the statement 
  501.  
  502.               abcd::    nop 
  503.  
  504.         establishes the label abcd as a global symbol.  The distinguish-
  505.         ing attribute of a global symbol is that it  can  be  referenced
  506.         from  within an object module other than the module in which the
  507.         symbol is defined.  References to this label  in  other  modules
  508.         are  resolved when the modules are linked as a composite execut-
  509.         able image.  
  510.  
  511.         The legal characters for defining labels are:  
  512.  
  513.                 A through Z 
  514.                 a through z 
  515.                 0 through 9 
  516.                 . (Period) 
  517.                 $ (Dollar sign) 
  518.                 _ (underscore) 
  519.  
  520.            A  label may be any length, however, only the first eight (8)
  521.         characters are significant and, therefore must be  unique  among
  522.         all   labels  in  the  source  program  (not  necessarily  among
  523.  
  524.  
  525.         THE ASSEMBLER                                           PAGE 1-5
  526.         SOURCE PROGRAM FORMAT
  527.  
  528.  
  529.         separately compiled modules).  An error code(s) (m or p) will be
  530.         generated  in the assembly listing if the first eight characters
  531.         in two or more labels are the same.  The m code is caused by the
  532.         redeclaration  of  the symbol or its reference by another state-
  533.         ment.  The p code is generated because the symbols  location  is
  534.         changing on each pass through the source file.  
  535.  
  536.            The  label  must  not  start with the characters 0-9, as this
  537.         designates a local symbol with special attributes described in a
  538.         later section.  
  539.  
  540.  
  541.         1.2.1.2  Operator Field  - 
  542.  
  543.            The  operator field specifies the action to be performed.  It
  544.         may consist of an instruction mnemonic (op code) or an assembler
  545.         directive.  
  546.  
  547.            When  the  operator is an instruction mnemonic, a machine in-
  548.         struction is generated and the assembler evaluates the addresses
  549.         of  the operands which follow.  When the operator is a directive
  550.         ASxxxx performs certain control actions or processing operations
  551.         during assembly of the source program.  
  552.  
  553.            Leading  and  trailing  spaces  or tabs in the operator field
  554.         have no significance;  such characters serve  only  to  separate
  555.         the operator field from the preceeding and following fields.  
  556.  
  557.            An operator is terminated by a space, tab or end of line.  
  558.  
  559.  
  560.         1.2.1.3  Operand Field  - 
  561.  
  562.            When  the  operator is an instruction mnemonic (op code), the
  563.         operand  field  contains  program  variables  that  are  to   be
  564.         evaluated/manipulated by the operator.  
  565.  
  566.            Operands  may  be  expressions  or  symbols, depending on the
  567.         operator.  Multiple expressions used in the operand  fields  may
  568.         be  separated  by a comma.  An operand should be preceeded by an
  569.         operator field;  if it is not, the statement will give an  error
  570.         (q  or  o).   All  operands  following instruction mnemonics are
  571.         treated as expressions.  
  572.  
  573.            The operand field is terminated by a semicolon when the field
  574.         is followed  by  a  comment.   For  example,  in  the  following
  575.         statement:  
  576.  
  577.               label:    lda     abcd,x          ;Comment field 
  578.  
  579.         the  tab  between lda and abcd terminates the operator field and
  580.         defines the beginning of the operand field;  a  comma  separates
  581.  
  582.  
  583.         THE ASSEMBLER                                           PAGE 1-6
  584.         SOURCE PROGRAM FORMAT
  585.  
  586.  
  587.         the operands abcd and x;  and a semicolon terminates the operand
  588.         field and defines the beginning of the comment field.   When  no
  589.         comment  field  follows,  the operand field is terminated by the
  590.         end of the source line.  
  591.  
  592.  
  593.         1.2.1.4  Comment Field  - 
  594.  
  595.            The comment field begins with a semicolon and extends through
  596.         the end of the line.  This field is optional and may contain any
  597.         7-bit ascii character except null.  
  598.  
  599.            Comments  do not affect assembly processing or program execu-
  600.         tion.  
  601.  
  602.  
  603.         1.3  SYMBOLS AND EXPRESSIONS 
  604.  
  605.  
  606.            This  section  describes the generic components of the ASxxxx
  607.         assemblers:  the character set, the conventions observed in con-
  608.         structing  symbols,  and  the use of numbers, operators, and ex-
  609.         pressions.  
  610.  
  611.  
  612.         1.3.1  Character Set 
  613.  
  614.  
  615.            The following characters are legal in ASxxxx source programs: 
  616.  
  617.              1.  The  letters  A  through Z.  Both upper- and lower-case
  618.                  letters are acceptable.  The assemblers are case sensi-
  619.                  tive,  i.e.  ABCD and abcd are different symbols.  (The
  620.                  assemblers can be made case insensitive by  recompiling
  621.                  with the appropriate switches.) 
  622.  
  623.              2.  The digits 0 through 9 
  624.  
  625.              3.  The  characters . (period), $ (dollar sign), and _ (un-
  626.                  derscore).  
  627.  
  628.              4.  The special characters listed in Tables 1 through 6.  
  629.  
  630.  
  631.            Tables  1  through  6  describe  the various ASxxxx label and
  632.         field terminators, assignment operators, operand separators, as-
  633.         sembly, unary, binary, and radix operators.  
  634.  
  635.  
  636.         THE ASSEMBLER                                           PAGE 1-7
  637.         SYMBOLS AND EXPRESSIONS
  638.  
  639.  
  640.         Table 1         Label Terminators and Assignment Operators 
  641.         ---------------------------------------------------------------- 
  642.  
  643.                 :   Colon               Label terminator.  
  644.  
  645.                 ::  Double colon        Label  Terminator;   defines the
  646.                                         label as a global label.  
  647.  
  648.                 =   Equal sign          Direct assignment operator.  
  649.  
  650.                 ==  Double equal        Direct assignment operator;  
  651.                     sign                defines  the  symbol as a global
  652.                                         symbol.  
  653.  
  654.         ---------------------------------------------------------------- 
  655.  
  656.  
  657.  
  658.  
  659.  
  660.         Table 2         Field Terminators and Operand Separators 
  661.         ---------------------------------------------------------------- 
  662.  
  663.                     Tab                 Item or field terminator.  
  664.  
  665.                     Space               Item or field terminator.  
  666.  
  667.                 ,   Comma               Operand field separator.  
  668.  
  669.                 ;   Semicolon           Comment field indicator.  
  670.  
  671.         ---------------------------------------------------------------- 
  672.  
  673.  
  674.  
  675.  
  676.  
  677.         Table 3         Assembler Operators 
  678.         ---------------------------------------------------------------- 
  679.  
  680.                 #   Number sign         Immediate expression indicator. 
  681.  
  682.                 .   Period              Current location counter.  
  683.  
  684.                 (   Left parenthesis    Expression delimiter.  
  685.  
  686.                 )   Right parenthesis   Expression delimeter.  
  687.  
  688.         ---------------------------------------------------------------- 
  689.  
  690.  
  691.         THE ASSEMBLER                                           PAGE 1-8
  692.         SYMBOLS AND EXPRESSIONS
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.         Table 4         Unary Operators 
  701.         ---------------------------------------------------------------- 
  702.  
  703.                 <   Left bracket        <FEDC   Produces  the lower byte
  704.                                                 value of the expression.
  705.                                                 (DC) 
  706.  
  707.                 >   Right bracket       >FEDC   Produces  the upper byte
  708.                                                 value of the expression.
  709.                                                 (FE) 
  710.  
  711.                 +   Plus sign           +A      Positive value of A 
  712.  
  713.                 -   Minus sign          -A      Produces   the  negative
  714.                                                 (2's complement) of A.  
  715.  
  716.                 ~   Tilde               ~A      Produces the 1's comple-
  717.                                                 ment of A.  
  718.  
  719.                 '   Single quote        'D      Produces  the  value  of
  720.                                                 the character D.  
  721.  
  722.                 "   Double quote        "AB     Produces the double byte
  723.                                                 value for AB.  
  724.  
  725.                 \   Backslash           '\n     Unix style characters 
  726.                                                 \b, \f, \n, \r, \t 
  727.                                      or '\001   or octal byte values.  
  728.  
  729.         ---------------------------------------------------------------- 
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.         THE ASSEMBLER                                           PAGE 1-9
  738.         SYMBOLS AND EXPRESSIONS
  739.  
  740.  
  741.         Table 5         Binary Operators 
  742.         ---------------------------------------------------------------- 
  743.  
  744.                 <<  Double          0800 << 4   Produces the 4 bit 
  745.                     Left bracket                left-shifted   value  of
  746.                                                 0800.  (8000) 
  747.  
  748.                 >>  Double          0800 >> 4   Produces the 4 bit 
  749.                     Right bracket               right-shifted  value  of
  750.                                                 0800.  (0080) 
  751.  
  752.                 +   Plus sign       A + B       Arithmetic      Addition
  753.                                                 operator.  
  754.  
  755.                 -   Minus sign      A - B       Arithmetic   Subtraction
  756.                                                 operator.  
  757.  
  758.                 *   Asterisk        A * B       Arithmetic   Multiplica-
  759.                                                 tion operator.   (signed
  760.                                                 16-bit) 
  761.  
  762.                 /   Slash           A / B       Arithmetic      Division
  763.                                                 operator.        (signed
  764.                                                 16-bit quotient) 
  765.  
  766.                 &   Ampersand       A & B       Logical AND operator.  
  767.  
  768.                 |   Bar             A | B       Logical OR operator.  
  769.  
  770.                 %   Percent sign    A % B       Modulus operator.  
  771.                                                 (16-bit value) 
  772.  
  773.                 ^   Up arrow or     A ^ B       EXCLUSIVE OR operator.  
  774.                     circumflex 
  775.  
  776.         ---------------------------------------------------------------- 
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.         THE ASSEMBLER                                          PAGE 1-10
  785.         SYMBOLS AND EXPRESSIONS
  786.  
  787.  
  788.         Table 6         Temporary Radix Operators 
  789.         ---------------------------------------------------------------- 
  790.  
  791.                 0b, 0B                  Binary radix operator.  
  792.  
  793.                 0@, 0o, 0O, 0q, 0Q      Octal radix operator.  
  794.  
  795.                 0d, 0D                  Decimal radix operator.  
  796.  
  797.                 0h, 0H, 0x, 0X          Hexidecimal radix operator.  
  798.  
  799.  
  800.                 Potential  ambiguities arising from the use of 0b and 0d
  801.                 as temporary radix operators may be circumvented by pre-
  802.                 ceding  all  non-prefixed  hexidecimal  numbers with 00.
  803.                 Leading 0's are required in any  case  where  the  first
  804.                 hexidecimal  digit is abcdef as the assembler will treat
  805.                 the letter sequence as a label.  
  806.  
  807.         ---------------------------------------------------------------- 
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.         1.3.2  User-Defined Symbols 
  816.  
  817.  
  818.            User-defined  symbols are those symbols that are equated to a
  819.         specific value through a direct assignment statement  or  appear
  820.         as  labels.  These symbols are added to the User Symbol Table as
  821.         they are encountered during assembly.  
  822.  
  823.         The following rules govern the creation of user-defined symbols: 
  824.  
  825.              1.  Symbols  can  be  composed  of alphanumeric characters,
  826.                  dollar signs ($),  periods  (.),  and  underscores  (_)
  827.                  only.  
  828.  
  829.              2.  The  first  character  of a symbol must not be a number
  830.                  (except in the case of local symbols).  
  831.  
  832.              3.  The  first eight characters of a symbol must be unique.
  833.                  A symbol can be written  with  more  than  eight  legal
  834.                  characters, but the ninth and subsequent characters are
  835.                  ignored.  
  836.  
  837.              4.  Spaces and Tabs must not be embedded within a symbol.  
  838.  
  839.  
  840.  
  841.  
  842.         THE ASSEMBLER                                          PAGE 1-11
  843.         SYMBOLS AND EXPRESSIONS
  844.  
  845.  
  846.         1.3.3  Local Symbols 
  847.  
  848.  
  849.            Local  symbols are specially formatted symbols used as labels
  850.         within a block of coding that has been delimited as a local sym-
  851.         bol  block.   Local  symbols  are  of  the form n$, where n is a
  852.         decimal integer from 0 to 255,  inclusive.   Examples  of  local
  853.         symbols are:  
  854.  
  855.               1$ 
  856.               27$ 
  857.               138$ 
  858.               244$ 
  859.  
  860.            The  range  of  a local symbol block consists of those state-
  861.         ments between two normally constructed  symbolic  labels.   Note
  862.         that a statement of the form:  
  863.  
  864.               ALPHA = EXPRESSION 
  865.  
  866.         is a direct assignment statement but does not create a label and
  867.         thus does not delimit the range of a local symbol block.  
  868.  
  869.            Note that the range of a local symbol block may extend across
  870.         program areas.  
  871.  
  872.            Local symbols provide a convenient means of generating labels
  873.         for branch instructions and other such references  within  local
  874.         symbol  blocks.   Using local symbols reduces the possibility of
  875.         symbols with multiple definitions appearing within a  user  pro-
  876.         gram.   In  addition,  the  use  of local symbols differentiates
  877.         entry-point labels from local labels, since local labels  cannot
  878.         be referenced from outside their respective local symbol blocks.
  879.         Thus, local symbols of the same name can appear in  other  local
  880.         symbol blocks without conflict.  Local symbols require less sym-
  881.         bol table space than normal symbols.  Their use is recommended. 
  882.  
  883.            The  use of the same local symbol within a local symbol block
  884.         will generate one or both of the m or p errors.  
  885.  
  886.  
  887.         THE ASSEMBLER                                          PAGE 1-12
  888.         SYMBOLS AND EXPRESSIONS
  889.  
  890.  
  891.         Example of local symbols:  
  892.  
  893.                 a:      ldx     #atable ;get table address
  894.                         lda     #0d48   ;table length
  895.                 1$:     clr     ,x+     ;clear
  896.                         deca
  897.                         bne     1$
  898.                         
  899.                 b:      ldx     #btable ;get table address
  900.                         lda     #0d48   ;table length
  901.                 1$:     clr     ,x+     ;clear
  902.                         deca
  903.                         bne     1$
  904.  
  905.  
  906.         1.3.4  Current Location Counter 
  907.  
  908.  
  909.            The  period  (.) is the symbol for the current location coun-
  910.         ter.  When used in the operand  field  of  an  instruction,  the
  911.         period   represents  the  address  of  the  first  byte  of  the
  912.         instruction:  
  913.  
  914.                 AS:     ldx     #.      ;The period (.) refers to
  915.                                         ;the address of the ldx
  916.                                         ;instruction.
  917.  
  918.            When  used  in  the  operand field of an ASxxxx directive, it
  919.         represents the address of the current byte or word:  
  920.  
  921.                 QK = 0
  922.         
  923.                 .word   0xFFFE,.+4,QK   ;The operand .+4 in the .word
  924.                                         ;directive represents a value
  925.                                         ;stored in the second of the
  926.                                         ;three words during assembly.
  927.  
  928.            If  we  assume  the  current  value of the program counter is
  929.         0H0200, then during assembly, ASxxxx  reserves  three  words  of
  930.         storage  starting  at  location 0H0200.  The first value, a hex-
  931.         idecimal constant FFFE, will be stored at location 0H0200.   The
  932.         second  value  represented  by  .+4  will  be stored at location
  933.         0H0202, its value will be 0H0206 ( = 0H0202  +  4).   The  third
  934.         value  defined  by  the  symbol  QK  will  be placed at location
  935.         0H0204.  
  936.  
  937.            At the beginning of each assembly pass, ASxxxx resets the lo-
  938.         cation counter.  Normally, consecutive memory locations are  as-
  939.         signed  to  each  byte  of  object code generated.  However, the
  940.         value of the location counter can be changed  through  a  direct
  941.         assignment statement of the following form:  
  942.  
  943.  
  944.  
  945.         THE ASSEMBLER                                          PAGE 1-13
  946.         SYMBOLS AND EXPRESSIONS
  947.  
  948.  
  949.               . = . + expression 
  950.  
  951.  
  952.            The  new  location  counter can only be specified relative to
  953.         the current location counter.  Neglecting to specify the current
  954.         program  counter  along with the expression on the right side of
  955.         the assignment operator will generate the (.) error.   (Absolute
  956.         program areas may use the .org directive to specify the absolute
  957.         location of the current program counter.) 
  958.  
  959.         The following coding illustrates the use of the current location
  960.         counter:  
  961.  
  962.                 .area   CODE1   (ABS)   ;program area CODE1
  963.                                         ;is ABSOLUTE
  964.         
  965.                 .org    0H100           ;set location to
  966.                                         ;0H100 absolute
  967.         
  968.         num1:   ldx     #.+0H10         ;The label num1 has
  969.                                         ;the value 0H100.
  970.                                         ;X is loaded with
  971.                                         ;0H100 + 0H10
  972.         
  973.                 .org    0H130           ;location counter
  974.                                         ;set to 0H130
  975.         
  976.         num2:   ldy     #.              ;The label num2 has
  977.                                         ;the value 0H130.
  978.                                         ;Y is loaded with
  979.                                         ;value 0H130.
  980.         
  981.         
  982.                 .area   CODE2   (REL)   ;program area CODE2
  983.                                         ;is RELOCATABLE
  984.         
  985.                 . = . + 0H20            ;Set location counter
  986.                                         ;to relocatable 0H20 of
  987.                                         ;the program section.
  988.         
  989.         num3:   .word   0               ;The label num3 has
  990.                                         ;the value
  991.                                         ;of relocatable 0H20.
  992.         
  993.                 . = . + 0H40            ;will reserve 0H40
  994.                                         ;bytes of storage as will
  995.                 .blkb   0H40            ;or
  996.                 .blkw   0H20
  997.  
  998.            The  .blkb  and .blkw directives are the preferred methods of
  999.         allocating space.  
  1000.  
  1001.  
  1002.  
  1003.         THE ASSEMBLER                                          PAGE 1-14
  1004.         SYMBOLS AND EXPRESSIONS
  1005.  
  1006.  
  1007.         1.3.5  Numbers 
  1008.  
  1009.  
  1010.            ASxxxx  assumes that all numbers in the source program are to
  1011.         be interpreted in decimal radix unless otherwise specified.  The
  1012.         .radix  directive  may  be used to specify the default as octal,
  1013.         decimal, or hexidecimal.  Individual numbers can  be  designated
  1014.         as  binary, octal, decimal, or hexidecimal through the temporary
  1015.         radix prefixes shown in table 6.  
  1016.  
  1017.            Negative  numbers  must be preceeded by a minus sign;  ASxxxx
  1018.         translates such numbers into two's  complement  form.   Positive
  1019.         numbers may (but need not) be preceeded by a plus sign.  
  1020.  
  1021.            Numbers are always considered to be absolute values, therefor
  1022.         they are never relocatable.  
  1023.  
  1024.  
  1025.         1.3.6  Terms 
  1026.  
  1027.  
  1028.            A  term is a component of an expression and may be one of the
  1029.         following:  
  1030.  
  1031.  
  1032.              1.  A number.  
  1033.  
  1034.              2.  A symbol:  
  1035.                  1.  A  period (.) specified in an expression causes the
  1036.                      current location counter to be used.  
  1037.                  2.  A User-defined symbol.  
  1038.                  3.  An undefined symbol is assigned a value of zero and
  1039.                      inserted in the User-Defined symbol table as an un-
  1040.                      defined symbol.  
  1041.  
  1042.              3.  A single quote followed by a single ascii character, or
  1043.                  a double quote followed by two ascii characters.  
  1044.  
  1045.              4.  An  expression enclosed in parenthesis.  Any expression
  1046.                  so enclosed is evaluated and reduced to a  single  term
  1047.                  before  the remainder of the expression in which it ap-
  1048.                  pears is evaluated.  Parenthesis, for example,  may  be
  1049.                  used  to  alter the left-to-right evaluation of expres-
  1050.                  sions, (as in A*B+C versus A*(B+C)), or to apply a  un-
  1051.                  ary operator to an entire expression (as in -(A+B)).  
  1052.  
  1053.              5.  A unary operator followed by a symbol or number.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.         THE ASSEMBLER                                          PAGE 1-15
  1060.         SYMBOLS AND EXPRESSIONS
  1061.  
  1062.  
  1063.         1.3.7  Expressions 
  1064.  
  1065.  
  1066.            Expressions  are  combinations  of  terms  joined together by
  1067.         binary operators.  Expressions reduce to a  16-bit  value.   The
  1068.         evaluation  of  an  expression includes the determination of its
  1069.         attributes.  A resultant expression value may be  one  of  three
  1070.         types  (as  described  later in this section):  relocatable, ab-
  1071.         solute, and external.  
  1072.  
  1073.         Expressions are evaluate with an operand hierarchy as follows:  
  1074.  
  1075.                 *       /       %       multiplication,
  1076.                                         division, and
  1077.                                         modulus first.
  1078.         
  1079.                 +       -               addition and
  1080.                                         subtraction second.
  1081.         
  1082.                 <<      >>              left shift and
  1083.                                         right shift third.
  1084.         
  1085.                 ^                       exclusive or fourth.
  1086.         
  1087.                 &                       logical and fifth.
  1088.         
  1089.                 |                       logical or last
  1090.         
  1091.                 except that unary operators take precedence over binary
  1092.                 operators.
  1093.  
  1094.  
  1095.            A  missing  or  illegal  operator  terminates  the expression
  1096.         analysis, causing error codes (o) and/or  (q)  to  be  generated
  1097.         depending upon the context of the expression itself.  
  1098.  
  1099.            At assembly time the value of an external (global) expression
  1100.         is equal to the value of the absolute part of  that  expression.
  1101.         For  example,  the expression external+4, where 'external' is an
  1102.         external symbol, has the value of 4.  This expression,  however,
  1103.         when  evaluated  at link time takes on the resolved value of the
  1104.         symbol 'external', plus 4.  
  1105.  
  1106.            Expressions,  when  evaluated  by  ASxxxx,  are  one of three
  1107.         types:  relocatable, absolute, or external.  The following  dis-
  1108.         tinctions are important:  
  1109.  
  1110.              1.  An  expression is relocatable if its value is fixed re-
  1111.                  lative to the base address of the program area in which
  1112.                  it appears;  it will have an offset value added at link
  1113.                  time.  Terms that contain labels defined in relocatable
  1114.                  program   areas   will   have   a   relocatable  value;
  1115.  
  1116.  
  1117.         THE ASSEMBLER                                          PAGE 1-16
  1118.         SYMBOLS AND EXPRESSIONS
  1119.  
  1120.  
  1121.                  similarly, a period (.) in a relocatable program  area,
  1122.                  representing  the value of the current program location
  1123.                  counter, will also have a relocatable value.  
  1124.  
  1125.              2.  An  expression  is  absolute if its value is fixed.  An
  1126.                  expression whose terms are numbers and ascii characters
  1127.                  will  reduce  to  an absolute value.  A relocatable ex-
  1128.                  pression or term minus a relocatable term,  where  both
  1129.                  elements  being  evaluated  belong  to the same program
  1130.                  area, is an absolute expression.  This is because every
  1131.                  term  in  a  program area has the same relocation bias.
  1132.                  When one term is subtracted from the other the  reloca-
  1133.                  tion bias is zero.  
  1134.  
  1135.              3.  An  expression is external (or global) if it contains a
  1136.                  single global reference (plus or minus an absolute  ex-
  1137.                  pression  value) that is not defined within the current
  1138.                  program.  Thus, an external  expression  is  only  par-
  1139.                  tially  defined following assembly and must be resolved
  1140.                  at link time.  
  1141.  
  1142.  
  1143.  
  1144.         1.4  GENERAL ASSEMBLER DIRECTIVES 
  1145.  
  1146.  
  1147.            An  ASxxxx  directive  is placed in the operator field of the
  1148.         source line.  Only one directive is  allowed  per  source  line.
  1149.         Each  directive  may  have  a blank operand field or one or more
  1150.         operands.  Legal operands differ with each directive.  
  1151.  
  1152.  
  1153.         1.4.1  .module Directive 
  1154.  
  1155.         Format:  
  1156.  
  1157.                 .module string 
  1158.  
  1159.            The .module directive causes the string to be included in the
  1160.         assemblers output file as an identifier for this particular  ob-
  1161.         ject  module.   The  string  may  be  from  1 to 8 characters in
  1162.         length.  Only one identifier is allowed  per  assembled  module.
  1163.         The  main use of this directive is to allow the linker to report
  1164.         a modules' use of undefined symbols.  At link time all undefined
  1165.         symbols  are  reported  and  the  modules  referencing  them are
  1166.         listed.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.         THE ASSEMBLER                                          PAGE 1-17
  1172.         GENERAL ASSEMBLER DIRECTIVES
  1173.  
  1174.  
  1175.         1.4.2  .title Directive 
  1176.  
  1177.         Format:  
  1178.  
  1179.                 .title  string 
  1180.  
  1181.            The .title directive provides a character string to be placed
  1182.         on the second line of each page during listing.  
  1183.  
  1184.  
  1185.         1.4.3  .sbttl Directive 
  1186.  
  1187.         Format:  
  1188.  
  1189.                 .sbttl  string 
  1190.  
  1191.            The .sbttl directive provides a character string to be placed
  1192.         on the third line of each page during listing.  
  1193.  
  1194.  
  1195.         1.4.4  .page Directive 
  1196.  
  1197.         Format:  
  1198.  
  1199.                 .page 
  1200.  
  1201.            The .page directive causes a page ejection with a new heading
  1202.         to be printed.  The new page occurs after the next line  of  the
  1203.         source  program is processed, this allows an immediately follow-
  1204.         ing .sbttl directive to appear  on  the  new  page.   The  .page
  1205.         source line will not appear in the file listing.  
  1206.  
  1207.  
  1208.         1.4.5  .byte and .db Directives 
  1209.  
  1210.         Format:  
  1211.  
  1212.                 .byte   exp             ;Stores the binary value
  1213.                 .db     exp             ;of the expression in the
  1214.                                         ;next byte.
  1215.         
  1216.                 .byte   exp1,exp2,expn  ;Stores the binary values
  1217.                 .db     exp1,exp2,expn  ;of the list of expressions
  1218.                                         ;in successive bytes.
  1219.         
  1220.         where:  exp,    represent expressions that will be
  1221.                 exp1,   truncated to 8-bits of data.
  1222.                 .       Each expression will be calculated
  1223.                 .       as a 16-bit word expression,
  1224.                 .       the high-order byte will be truncated.
  1225.                 .       Multiple expressions must be
  1226.                 expn    separated by commas.
  1227.  
  1228.  
  1229.         THE ASSEMBLER                                          PAGE 1-18
  1230.         GENERAL ASSEMBLER DIRECTIVES
  1231.  
  1232.  
  1233.            The  .byte  or .db directives are used to generate successive
  1234.         bytes of binary data in the object module.  
  1235.  
  1236.  
  1237.         1.4.6  .word and .dw Directives 
  1238.  
  1239.         Format:  
  1240.  
  1241.                 .word   exp             ;Stores the binary value
  1242.                 .dw     exp             ;of the expression in
  1243.                                         ;the next word.
  1244.         
  1245.                 .word   exp1,exp2,expn  ;Stores the binary values
  1246.                 .dw     exp1,exp2,expn  ;of the list of expressions
  1247.                                         ;in successive words.
  1248.         
  1249.         where:  exp,    represent expressions that will occupy two
  1250.                 exp1,   bytes of data. Each expression will be
  1251.                 .       calculated as a 16-bit word expression.
  1252.                 .       Multiple expressions must be
  1253.                 expn    separated by commas.
  1254.  
  1255.            The  .word  or .dw directives are used to generate successive
  1256.         words of binary data in the object module.  
  1257.  
  1258.  
  1259.         1.4.7  .blkb, .blkw, and .ds Directives 
  1260.  
  1261.         Format:  
  1262.  
  1263.                 .blkb   N       ;reserve N bytes of space
  1264.                 .blkw   N       ;reserve N words of space
  1265.                 .ds     N       ;reserve N bytes of space
  1266.  
  1267.            The  .blkb  and .ds directives reserve byte blocks in the ob-
  1268.         ject module;  the .blkw directive reserves word blocks.  
  1269.  
  1270.  
  1271.         1.4.8  .ascii Directive 
  1272.  
  1273.         Format:  
  1274.  
  1275.                 .ascii  /string/ 
  1276.  
  1277.         where:  string  is a string of printable ascii characters.  
  1278.  
  1279.                 /  /    represent   the  delimiting  characters.   These
  1280.                         delimiters   may   be   any   paired    printing
  1281.                         characters,  as  long  as the characters are not
  1282.                         contained within  the  string  itself.   If  the
  1283.                         delimiting  characters  do not match, the .ascii
  1284.                         directive will give the (q) error.  
  1285.  
  1286.  
  1287.         THE ASSEMBLER                                          PAGE 1-19
  1288.         GENERAL ASSEMBLER DIRECTIVES
  1289.  
  1290.  
  1291.  
  1292.         The  .ascii  directive  places  one binary byte of data for each
  1293.         character in the string into the object module.  
  1294.  
  1295.  
  1296.         1.4.9  .asciz Directive 
  1297.  
  1298.         Format:  
  1299.  
  1300.                 .asciz  /string/ 
  1301.  
  1302.         where:  string  is a string of printable asciz characters.  
  1303.  
  1304.                 /  /    represent   the  delimiting  characters.   These
  1305.                         delimiters   may   be   any   paired    printing
  1306.                         characters,  as  long  as the characters are not
  1307.                         contained within  the  string  itself.   If  the
  1308.                         delimiting  characters  do not match, the .asciz
  1309.                         directive will give the (q) error.  
  1310.  
  1311.         The  .ascii  directive  places  one binary byte of data for each
  1312.         character in the string into the object module.   Following  all
  1313.         the  character  data  a  zero  byte is inserted to terminate the
  1314.         character string.  
  1315.  
  1316.  
  1317.         1.4.10  .radix Directive 
  1318.  
  1319.         Format:  
  1320.  
  1321.                 .radix  character 
  1322.  
  1323.         where:  character  represents  a single character specifying the
  1324.                         default radix to be used for succeeding numbers.
  1325.                         The character may be any one of the following:  
  1326.  
  1327.                         B,b     Binary
  1328.         
  1329.                         O,o     Octal
  1330.                         Q,q
  1331.                         @
  1332.         
  1333.                         D,d     Decimal
  1334.                         'blank'
  1335.         
  1336.                         H,h     Hexidecimal
  1337.                         X,x
  1338.  
  1339.  
  1340.  
  1341.  
  1342.         THE ASSEMBLER                                          PAGE 1-20
  1343.         GENERAL ASSEMBLER DIRECTIVES
  1344.  
  1345.  
  1346.         1.4.11  .even Directive 
  1347.  
  1348.         Format:  
  1349.  
  1350.                 .even 
  1351.  
  1352.            The .even directive ensures that the current location counter
  1353.         contains an even boundary value by adding 1 if the current loca-
  1354.         tion is odd.  
  1355.  
  1356.  
  1357.         1.4.12  .odd Directive 
  1358.  
  1359.         Format:  
  1360.  
  1361.                 .odd 
  1362.  
  1363.            The  .odd directive ensures that the current location counter
  1364.         contains an odd boundary value by adding one if the current  lo-
  1365.         cation is even.  
  1366.  
  1367.  
  1368.         1.4.13  .area Directive 
  1369.  
  1370.         Format:  
  1371.  
  1372.                 .area   name    [(options)] 
  1373.  
  1374.         where:  name    represents the symbolic name of the program sec-
  1375.                         tion.   This  name  may  be  the  same  as   any
  1376.                         user-defined  symbol  as  the area names are in-
  1377.                         dependent of all symbols and labels.  
  1378.  
  1379.                 options specify the type of program or data area:  
  1380.                         ABS     absolute (automatically invokes OVR) 
  1381.                         REL     relocatable 
  1382.                         OVR     overlay 
  1383.                         CON     concatenate 
  1384.                         PAG     paged area 
  1385.  
  1386.  
  1387.            The .area directive provides a means of defining and separat-
  1388.         ing multiple programming and data sections.   The  name  is  the
  1389.         area  label used by the assembler and the linker to collect code
  1390.         from various separately assembled modules into one section.  The
  1391.         name may be from 1 to 8 characters in length.  
  1392.  
  1393.            The options are specified within parenthesis and separated by
  1394.         commas as shown in the following example:  
  1395.  
  1396.                 .area  TEST  (REL,CON)  ;This section is relocatable
  1397.                                         ;and concatenated with other
  1398.  
  1399.  
  1400.         THE ASSEMBLER                                          PAGE 1-21
  1401.         GENERAL ASSEMBLER DIRECTIVES
  1402.  
  1403.  
  1404.                                         ;sections of this program area.
  1405.         
  1406.                 .area  DATA  (REL,OVR)  ;This section is relocatable
  1407.                                         ;and overlays other sections
  1408.                                         ;of this program area.
  1409.         
  1410.                 .area  SYS   (ABS,OVR)  ;(CON not allowed with ABS)
  1411.                                         ;This section is defined as
  1412.                                         ;absolute. Absolute sections
  1413.                                         ;are always overlayed with
  1414.                                         ;other sections of this program
  1415.                                         ;area.
  1416.         
  1417.                 .area  PAGE  (PAG)      ;This is a paged section. The
  1418.                                         ;section must be on a 256 byte
  1419.                                         ;boundary and its length is
  1420.                                         ;checked by the linker to be
  1421.                                         ;no larger than 256 bytes.
  1422.                                         ;This is useful for direct page
  1423.                                         ;areas.
  1424.  
  1425.            The  default  area type is REL|CON;  i.e.  a relocatable sec-
  1426.         tion which is concatenated with other sections of code with  the
  1427.         same area name.  The ABS option indicates an absolute area.  The
  1428.         OVR and CON options indicate if program  sections  of  the  same
  1429.         name  will overlay each other (start at the same location) or be
  1430.         concatenated with each other (appended to each other).  
  1431.  
  1432.            Multiple  invocations  of  the  .area directive with the same
  1433.         name must specify the same options or leave  the  options  field
  1434.         blank,  this  defaults  to  the previously specified options for
  1435.         this program area.  
  1436.  
  1437.            The  ASxxxx  assemblers  automatically  provide  two  program
  1438.         sections:  
  1439.  
  1440.                 '.  .ABS.'      This dumby section contains all absolute
  1441.                                 symbols and their values.  
  1442.  
  1443.                 '_CODE'         This  is  the default program/data area.
  1444.                                 This program area is of type (REL,CON). 
  1445.  
  1446.  
  1447.  
  1448.  
  1449.         THE ASSEMBLER                                          PAGE 1-22
  1450.         GENERAL ASSEMBLER DIRECTIVES
  1451.  
  1452.  
  1453.         1.4.14  .org Directive 
  1454.  
  1455.         Format:  
  1456.  
  1457.                 .org    exp 
  1458.  
  1459.         where:  exp     is  an absolute expression that becomes the cur-
  1460.                         rent location counter.  
  1461.  
  1462.         The  .org directive is valid only in an absolute program section
  1463.         and will give a (q) error if used in a relocatable program area.
  1464.         The  .org  directive specifies that the current location counter
  1465.         is to become the specified absolute value.  
  1466.  
  1467.  
  1468.         1.4.15  .globl Directive 
  1469.  
  1470.         Format:  
  1471.  
  1472.                 .globl  sym1,sym2,...,symn 
  1473.  
  1474.         where:  sym1,           represent legal symbolic names. When
  1475.                 sym2,...        When multiple symbols are specified,
  1476.                 symn            they are separated by commas.
  1477.  
  1478.            A  .globl directive may also have a label field and/or a com-
  1479.         ment field.  
  1480.  
  1481.            The  .globl directive is provided to define (and thus provide
  1482.         linkage to) symbols not  otherwise  defined  as  global  symbols
  1483.         within  a  module.   In  defining  global  symbols the directive
  1484.         .globl J is similar to:  
  1485.  
  1486.               J == expression or J::  
  1487.  
  1488.            Because  object  modules  are linked by global symbols, these
  1489.         symbols are vital to a program.  All internal symbols  appearing
  1490.         within  a  given program must be defined at the end of pass 1 or
  1491.         they will be considered undefined.  The assembly directive  (-g)
  1492.         can  be  be  invoked to make all undefined symbols global at the
  1493.         end of pass 1.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.         THE ASSEMBLER                                          PAGE 1-23
  1499.         GENERAL ASSEMBLER DIRECTIVES
  1500.  
  1501.  
  1502.         1.4.16  .if, .else, and .endif Directives 
  1503.  
  1504.         Format:  
  1505.  
  1506.                 .if     expr
  1507.                 .                       ;}
  1508.                 .                       ;} range of true condition
  1509.                 .                       ;}
  1510.                 .else
  1511.                 .                       ;}
  1512.                 .                       ;} range of false condition
  1513.                 .                       ;}
  1514.                 .endif
  1515.  
  1516.            The  conditional  assembly directives allow you to include or
  1517.         exclude blocks of source code during the assembly process, based
  1518.         on the evaluation of the condition test.  
  1519.  
  1520.            The  range of true condition will be processed if the expres-
  1521.         sion 'expr' is not zero (i.e.  true) and the range of false con-
  1522.         dition  will  be processed if the expression 'expr' is zero (i.e
  1523.         false).  The range of true condition is optional as is the .else
  1524.         directive  and  the range of false condition.  The following are
  1525.         all valid .if/.else/.endif constructions:  
  1526.  
  1527.                 .if     A-4             ;evaluate A-4
  1528.                 .byte   1,2             ;insert bytes if A-4 is
  1529.                 .endif                  ;not zero
  1530.         
  1531.                 .if     K+3             ;evaluate K+3
  1532.                 .else
  1533.                 .byte   3,4             ;insert bytes if K+3
  1534.                 .endif                  ;is zero
  1535.         
  1536.                 .if     J&3             ;evaluate J masked by 3
  1537.                 .byte   12              ;insert this byte if J&3
  1538.                 .else                   ;is not zero
  1539.                 .byte   13              ;insert this byte if J&3
  1540.                 .endif                  ;is zero
  1541.  
  1542.  
  1543.         The .if/.else/.endif directives may be nested upto 10 levels.  
  1544.  
  1545.            The  .page  directive  is  processed within a false condition
  1546.         range to allow extended textual information to  be  incorporated
  1547.         in  the  source  program  with  out  the need to use the comment
  1548.         delimiter (;):  
  1549.  
  1550.                 .if     0
  1551.         
  1552.                 .page
  1553.                 This text will be bypassed during assembly
  1554.  
  1555.  
  1556.         THE ASSEMBLER                                          PAGE 1-24
  1557.         GENERAL ASSEMBLER DIRECTIVES
  1558.  
  1559.  
  1560.                 but appear in the listing file.
  1561.                 .
  1562.                 .
  1563.                 .
  1564.         
  1565.                 .endif
  1566.  
  1567.  
  1568.         1.4.17  .include Directive 
  1569.  
  1570.         Format:  
  1571.  
  1572.                 .include        string 
  1573.  
  1574.         where:  string  represents  a  delimited string that is the file
  1575.                         specification of an ASxxxx source file.  
  1576.  
  1577.            The .include directive is used to insert a source file within
  1578.         the source file currently being assembled.  When this  directive
  1579.         is encountered, an implicit .page directive is issued.  When the
  1580.         end of the specified source file is reached, an  implicit  .page
  1581.         directive is issued and input continues from the previous source
  1582.         file.  The maximum nesting level of source files specified by  a
  1583.         .include  directive  is  five.  The line containing the .include
  1584.         directive will not appear in the listing file.  
  1585.  
  1586.            The  total  number  of separately specified .include files is
  1587.         unlimited as each .include file is opened and then closed during
  1588.         each pass made by the assembler.  
  1589.  
  1590.  
  1591.         1.4.18  .setdp Directive 
  1592.  
  1593.         Format:  
  1594.  
  1595.                 .setdp [base [,area]] 
  1596.  
  1597.         The  set  direct  page  directive has a common format in all the
  1598.         AS68xx assemblers.  The .setdp directive is used to  inform  the
  1599.         assembler  of  the current direct page region and the offset ad-
  1600.         dress within the selected area.  The normal  invocation  methods
  1601.         are:  
  1602.  
  1603.                 .area   DIRECT  (PAG)
  1604.                 .setdp
  1605.         
  1606.                 or
  1607.         
  1608.                 .setdp  0,DIRECT
  1609.  
  1610.         for  all  the  68xx microprocessors (the 6804 has only the paged
  1611.         ram area).  The commands specify that the direct page is in area
  1612.  
  1613.  
  1614.         THE ASSEMBLER                                          PAGE 1-25
  1615.         GENERAL ASSEMBLER DIRECTIVES
  1616.  
  1617.  
  1618.         DIRECT and its offset address is 0 (the only valid value for all
  1619.         but the 6809 microprocessor).  Be sure to place the DIRECT  area
  1620.         at address 0 during linking.  When the base address and area are
  1621.         not specified, then zero and the current area are the  defaults.
  1622.         If  a  .setdp directive is not issued the assembler defaults the
  1623.         direct page to the area "_CODE" at offset 0.  
  1624.  
  1625.            The  assembler  verifies  that  any  local variable used in a
  1626.         direct variable reference is located in this area.  Local  vari-
  1627.         able  and  constant value direct access addresses are checked to
  1628.         be within the address range from 0 to 255.  
  1629.  
  1630.            External direct references are assumed by the assembler to be
  1631.         in the correct area and have valid  offsets.   The  linker  will
  1632.         check all direct page relocations to verify that they are within
  1633.         the correct area.  
  1634.  
  1635.            The  6809  microprocessor  allows the selection of the direct
  1636.         page to be on any 256 byte boundary by loading  the  appropriate
  1637.         value  into the dp register.  Typically one would like to select
  1638.         the page boundary at link time, one method follows:  
  1639.  
  1640.                 .area   DIRECT  (PAG)   ; define the direct page
  1641.                 .setdp
  1642.                 .
  1643.                 .
  1644.                 .
  1645.                 .area   PROGRAM
  1646.                 .
  1647.                 ldd     #DIRECT         ; load the direct page register
  1648.                 tfr     a,dp            ; for access to the direct page
  1649.  
  1650.         At  link  time specify the base and global equates to locate the
  1651.         direct page:  
  1652.  
  1653.                 -b DIRECT = 0x1000
  1654.                 -g DIRECT = 0x1000
  1655.  
  1656.         Both  the  area address and offset value must be specified (area
  1657.         and variable names are independent).   The  linker  will  verify
  1658.         that  the  relocated  direct page accesses are within the direct
  1659.         page.  
  1660.  
  1661.  
  1662.         THE ASSEMBLER                                          PAGE 1-26
  1663.         GENERAL ASSEMBLER DIRECTIVES
  1664.  
  1665.  
  1666.         The  preceeding  sequence  could  be repeated for multiple paged
  1667.         areas, however an alternate method is to define a non-paged area
  1668.         and use the .setdp directive to specify the offset value:  
  1669.  
  1670.                 .area   DIRECT          ; define non-paged area
  1671.                 .
  1672.                 .
  1673.                 .
  1674.                 .area   PROGRAM
  1675.                 .
  1676.                 .setdp  0,DIRECT        ; direct page area
  1677.                 ldd     #DIRECT         ; load the direct page register
  1678.                 tfr     a,dp            ; for access to the direct page
  1679.                 .
  1680.                 .
  1681.                 .setdp  0x100,DIRECT    ; direct page area
  1682.                 ldd     #DIRECT+0x100   ; load the direct page register
  1683.                 tfr     a,dp            ; for access to the direct page
  1684.  
  1685.         The  linker  will  verify that subsequent direct page references
  1686.         are in the specified area and offset address range.  It  is  the
  1687.         programmers responsibility to load the dp register with the cor-
  1688.         rect page segment  corresponding  to  the  .setdp  base  address
  1689.         specified.  
  1690.  
  1691.            For  those  cases  where a single piece of code must access a
  1692.         defined data structure within a direct page and there  are  many
  1693.         pages,  define  a  dumby  direct page linked at address 0.  This
  1694.         dumby page is used only to define  the  variable  labels.   Then
  1695.         load  the dp register with the real base address but donot use a
  1696.         .setdp directive.  This method is equivalent to indexed address-
  1697.         ing,  where the dp register is the index register and the direct
  1698.         addressing is the offset.  
  1699.  
  1700.  
  1701.         1.5  INVOKING ASXXXX 
  1702.  
  1703.  
  1704.            The  ASxxxx  assemblers are command line oriented.  After the
  1705.         assembler is started, enter the option(s) and file(s) to  assem-
  1706.         ble following the 'argv:' prompt:  
  1707.  
  1708.         argv:  [-dqxgalosf] file1 [file2 file3 ...  file6] 
  1709.  
  1710.         The options are:  
  1711.  
  1712.                 d       decimal listing
  1713.                 q       octal   listing
  1714.                 x       hex     listing (default)
  1715.         
  1716.                         The listing radix affects the
  1717.                         .lst, .rel, and .sym files.
  1718.  
  1719.  
  1720.         THE ASSEMBLER                                          PAGE 1-27
  1721.         INVOKING ASXXXX
  1722.  
  1723.  
  1724.         
  1725.                 g       undefined symbols made global
  1726.                 a       all user symbols made global
  1727.         
  1728.                 l       create list   output file1.lst
  1729.                 o       create object output file1.rel
  1730.                 s       create symbol output file1.sym
  1731.         
  1732.                 f       flag relocatable references by  `   in the list-
  1733.         ing file
  1734.                 ff      flag relocatable references by mode in the list-
  1735.         ing file
  1736.  
  1737.            The file name for the .lst, .rel, and .sym files is the first
  1738.         file name specified in the command line.  All output  files  are
  1739.         ascii  text  files which may be edited, copied, etc.  The output
  1740.         files are the concatenation of all the input files, if files are
  1741.         to  be  assembled  independently  invoke  the assembler for each
  1742.         file.  
  1743.  
  1744.            The  .rel  file contains a radix directive so that the linker
  1745.         will use the proper conversion for this file.  Linked files  may
  1746.         have different radices.  
  1747.  
  1748.            If  the list (l) option is specified without the symbol table
  1749.         (s) option, the symbol table is placed at the end of the listing
  1750.         file.  
  1751.  
  1752.  
  1753.         1.6  ERRORS 
  1754.  
  1755.  
  1756.            The  ASxxxx assemblers provide limited diagnostic error codes
  1757.         during the assembly process, these errors will be noted  in  the
  1758.         listing file and printed on the stderr device.  The errors are: 
  1759.  
  1760.               (.)   This  error  is caused by an absolute direct assign-
  1761.                     ment of the current location counter 
  1762.                           . = expression (incorrect) 
  1763.                     rather than the correct 
  1764.                           . = . + expression 
  1765.  
  1766.               (a)   Indicates  a machine specific addressing or address-
  1767.                     ing mode error.  
  1768.  
  1769.               (b)   Indicates a direct page boundary error.  
  1770.  
  1771.               (d)   Indicates a direct page addressing error.  
  1772.  
  1773.               (i)   Caused  by  an  .include file error or an .if/.endif
  1774.                     mismatch.  
  1775.  
  1776.  
  1777.  
  1778.         THE ASSEMBLER                                          PAGE 1-28
  1779.         ERRORS
  1780.  
  1781.  
  1782.               (m)   Multiple  definitions  of  the  same label, multiple
  1783.                     .module directives, or multiple  conflicting  attri-
  1784.                     butes in an .area directive.  
  1785.  
  1786.               (o)   Directive  or  mnemonic error or the use of the .org
  1787.                     directive in a relocatable area.  
  1788.  
  1789.               (p)   Phase error:  label location changing between passes
  1790.                     2 and 3.  Normally caused by having  more  than  one
  1791.                     level of forward referencing.  
  1792.  
  1793.               (q)   Questionable syntax:  missing or improper operators,
  1794.                     terminators, or delimiters.  
  1795.  
  1796.               (r)   Relocation  error:   logic  operation attempted on a
  1797.                     relocatable term, addition of two relocatable terms,
  1798.                     subtraction  of two relocatable terms not within the
  1799.                     same programming area or external symbols.  
  1800.  
  1801.               (u)   Undefined symbol encountered during assembly.  
  1802.  
  1803.  
  1804.         1.7  LISTING FILE 
  1805.  
  1806.  
  1807.            The  (-l) option produces an ascii output listing file.  Each
  1808.         page of output contains a four line header:  
  1809.  
  1810.  
  1811.              1.  The ASxxxx program name and page number 
  1812.  
  1813.              2.  Title from a .title directive (if any) 
  1814.  
  1815.              3.  Subtitle from a .sbttl directive (if any) 
  1816.  
  1817.              4.  Blank line 
  1818.  
  1819.  
  1820.  
  1821.         Each succeeding line contains five fields:  
  1822.  
  1823.  
  1824.              1.  Error field (first three characters of line) 
  1825.  
  1826.              2.  Current location counter 
  1827.  
  1828.              3.  Generated code in byte format 
  1829.  
  1830.              4.  Source text line number 
  1831.  
  1832.              5.  Source text 
  1833.  
  1834.  
  1835.  
  1836.         THE ASSEMBLER                                          PAGE 1-29
  1837.         LISTING FILE
  1838.  
  1839.  
  1840.            The error field may contain upto 2 error flags indicating any
  1841.         errors encountered while assembling this line of source code.  
  1842.  
  1843.            The  current  location counter field displays the 16-bit pro-
  1844.         gram position.  This field will be in the selected radix.  
  1845.  
  1846.            The generated code follows the program location.  The listing
  1847.         radix determines the number of bytes that will be  displayed  in
  1848.         this field.  Hexidecimal listing allows six bytes of data within
  1849.         the field, decimal and octal allow four bytes within the  field.
  1850.         If more than one field of data is generated from the assembly of
  1851.         a single line of source code, then the data field is repeated on
  1852.         successive lines.  
  1853.  
  1854.            The source text line number is printed in decimal and is fol-
  1855.         lowed by the source text.  
  1856.  
  1857.            Two  special  cases  will  disable  the  listing of a line of
  1858.         source text:  
  1859.  
  1860.              1.  Source line with a .page directive is never listed.  
  1861.  
  1862.              2.  Source  line  with  a  .include  file  directive is not
  1863.                  listed unless the .include file cannot be opened.  
  1864.  
  1865.  
  1866.            Two  data  field  options  are  available to flag those bytes
  1867.         which will be relocated by the linker.   If  the  -f  option  is
  1868.         specified  then  each  byte to be relocated will be preceeded by
  1869.         the '`' character.  If the -ff option  is  specified  then  each
  1870.         byte  to  be relocated will be preceeded by one of the following
  1871.         characters:  
  1872.  
  1873.              1.  *   paged relocation 
  1874.  
  1875.              2.  u   unsigned byte relocation 
  1876.  
  1877.              3.  p   PCR byte or low  byte of word relocation 
  1878.  
  1879.              4.  q   PCR high byte of word relocation 
  1880.  
  1881.              5.  r   low  byte relocation 
  1882.  
  1883.              6.  s   high byte relocation 
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.         THE ASSEMBLER                                          PAGE 1-30
  1890.         SYMBOL TABLE FILE
  1891.  
  1892.  
  1893.         1.8  SYMBOL TABLE FILE 
  1894.  
  1895.  
  1896.            The symbol table has two parts:  
  1897.  
  1898.              1.  The alphabetically sorted list of symbols and/or labels
  1899.                  defined or referenced in the source program.  
  1900.  
  1901.              2.  A  list of the program areas defined during assembly of
  1902.                  the source program.  
  1903.  
  1904.  
  1905.            The sorted list of symbols and/or labels contains the follow-
  1906.         ing information:  
  1907.  
  1908.              1.  Program  area  number (none if absolute value or exter-
  1909.                  nal) 
  1910.  
  1911.              2.  The symbol or label 
  1912.  
  1913.              3.  Directly assigned symbol is denoted with an (=) sign 
  1914.  
  1915.              4.  The  value of a symbol, location of a label relative to
  1916.                  the program area base address (=0), or a ****  indicat-
  1917.                  ing the symbol or label is undefined.  
  1918.  
  1919.              5.  The  characters:   G - global, R - relocatable, and X -
  1920.                  external.  
  1921.  
  1922.  
  1923.            The list of program areas provides the correspondence between
  1924.         the program area numbers and the defined program areas, the size
  1925.         of the program areas, and the area flags (attributes).  
  1926.  
  1927.  
  1928.         1.9  OBJECT FILE 
  1929.  
  1930.  
  1931.            The  object  file is an ascii file containing the information
  1932.         needed by the linker to bind multiple object modules into a com-
  1933.         plete  loadable  memory  image.   The object module contains the
  1934.         following designators:  
  1935.  
  1936.                 [XDQ][HL]
  1937.                         X       Hexidecimal radix
  1938.                         D       Decimal radix
  1939.                         Q       Octal radix
  1940.         
  1941.                         H       Most significant byte first
  1942.                         L       Least significant byte first
  1943.         
  1944.                 H       Header 
  1945.  
  1946.  
  1947.         THE ASSEMBLER                                          PAGE 1-31
  1948.         OBJECT FILE
  1949.  
  1950.  
  1951.                 M       Module
  1952.                 A       Area
  1953.                 S       Symbol
  1954.                 T       Object code
  1955.                 R       Relocation information
  1956.                 P       Paging information
  1957.  
  1958.            Refer to the linker for a detailed description of each of the
  1959.         designators and the format of the information contained  in  the
  1960.         object file.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                                     CHAPTER 2
  1976.  
  1977.                                    THE LINKER
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.         2.1  ASLINK RELOCATING LINKER 
  1984.  
  1985.  
  1986.            ASLINK is the companion linker for the ASxxxx assemblers.  
  1987.  
  1988.            The  program ASLINK is a general relocating linker performing
  1989.         the following functions:  
  1990.  
  1991.              1.  Bind multiple object modules into a single memory image 
  1992.  
  1993.              2.  Resolve inter-module symbol references 
  1994.  
  1995.              3.  Combine  code  belonging to the same area from multiple
  1996.                  object files into a single contiguous memory region 
  1997.  
  1998.              4.  Perform   byte   and   word  program  counter  relative
  1999.                  (pc or pcr) addressing calculations 
  2000.  
  2001.              5.  Define absolute symbol values at link time 
  2002.  
  2003.              6.  Define absolute area base address values at link time 
  2004.  
  2005.              7.  Produce Intel Hex or Motorola S19 output file 
  2006.  
  2007.              8.  Produce a map of the linked memory image 
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.         THE LINKER                                              PAGE 2-2
  2014.         INVOKING ASLINK
  2015.  
  2016.  
  2017.         2.2  INVOKING ASLINK 
  2018.  
  2019.  
  2020.            The  linker  may run in the command line mode or command file
  2021.         modes.  The allowed startup linker commands are:  
  2022.  
  2023.         -c/-f           command line / command file modes 
  2024.  
  2025.         -p/-n           enable/disable echo file.lnk input to stdout 
  2026.  
  2027.            If  command  line  mode is selected, all linker commands come
  2028.         from stdin, if the command file mode is  selected  the  commands
  2029.         are input from the specified file (extension must be .lnk).  
  2030.  
  2031.            The linker is started via 
  2032.  
  2033.                 ASLINK  -(cfpn) 
  2034.  
  2035.         After invoking the linker the valid options are:  
  2036.  
  2037.              1.  -i/-s   Intel Hex (file.ihx) or Motorola S19 (file.s19)
  2038.                  image output file.  
  2039.  
  2040.              2.  -m      Generate a map file (file.map).  This file con-
  2041.                  tains a list of the symbols (by area) with absolute ad-
  2042.                  dresses,  sizes  of  linked  areas,  and  other linking
  2043.                  information.  
  2044.  
  2045.              3.  -xdq    Specifies  the  number  radix  for the map file
  2046.                  (Hexidecimal, Decimal, or Octal).  
  2047.  
  2048.              4.  fileN   Files  to  be linked.  Files may be on the same
  2049.                  line as the above options or on a separate line(s)  one
  2050.                  file  per line or multiple files separated by spaces or
  2051.                  tabs.  
  2052.  
  2053.              5.  -b  area = expression (one definition per line) 
  2054.                  This  specifies  an area base address where the expres-
  2055.                  sion may contain constants and/or defined symbols  from
  2056.                  the linked files.  
  2057.  
  2058.              6.  -g  symbol = expression (one definition per line) 
  2059.                  This  specifies  the value for the symbol where the ex-
  2060.                  pression may contain constants and/or  defined  symbols
  2061.                  from the linked files.  
  2062.  
  2063.              7.  -e      or null line, terminates input to the linker.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.         THE LINKER                                              PAGE 2-3
  2070.         ASLINK PROCESSING
  2071.  
  2072.  
  2073.         2.3  ASLINK PROCESSING 
  2074.  
  2075.  
  2076.            The  linker  processes  the  files  in  the  order  they  are
  2077.         presented.  The first pass through the input files  is  used  to
  2078.         define  all  program  areas, the section area sizes, and symbols
  2079.         defined or referenced.  After the first pass the -b  (area  base
  2080.         address)  definitions,  if  any,  are  processed  and  the areas
  2081.         linked.  
  2082.  
  2083.            The  area  linking proceeds by first examining the area types
  2084.         ABS, CON, REL, OVR and PAG.  Absolute areas (ABS) from  separate
  2085.         object modules are always overlayed and have been assembled at a
  2086.         specific address, these are not normally relocated (if a -b com-
  2087.         mand  is  used  on an absolute area the area will be relocated).
  2088.         Relative areas (normally defined as REL|CON) have a base address
  2089.         of  0x0000  as read from the object files, the -b command speci-
  2090.         fies the beginning address of the area.  All subsequent relative
  2091.         areas  will  be  concatenated  with  proceeding  relative areas.
  2092.         Where specific ordering is desired, the first linker input  file
  2093.         should  have  the area definitions in the desired order.  At the
  2094.         completion of the area linking all area  addresses  and  lengths
  2095.         have  been determined.  The areas of type PAG are verified to be
  2096.         on a 256 byte boundary and that the length does not  exceed  256
  2097.         bytes.  Any errors are noted on stderr and in the map file.  
  2098.  
  2099.            Next  the  global symbol definitions (-g option), if any, are
  2100.         processed.  The symbol definitions have been delayed until  this
  2101.         point because the absolute addresses of all internal symbols are
  2102.         known and can be used in the expression calculations.  
  2103.  
  2104.            Before  continuing  with the linking process the symbol table
  2105.         is scanned to determine if any symbols have been referenced  but
  2106.         not defined.  Undefined symbols are listed on the stderr device.
  2107.         if a .module directive was included in the  assembled  file  the
  2108.         module  making  the reference to this undefined variable will be
  2109.         printed.  
  2110.  
  2111.            Constants  defined  as global in more than one module will be
  2112.         flagged as multiple definitions if their values are not  identi-
  2113.         cal.  
  2114.  
  2115.            After  the  preceeding  processes are complete the linker may
  2116.         output a map file (-m option).  This file provides the following
  2117.         information:  
  2118.  
  2119.              1.  Global symbol values and label absolute addresses 
  2120.  
  2121.              2.  Defined areas and there lengths 
  2122.  
  2123.              3.  Remaining undefined symbols 
  2124.  
  2125.  
  2126.  
  2127.         THE LINKER                                              PAGE 2-4
  2128.         ASLINK PROCESSING
  2129.  
  2130.  
  2131.              4.  List of modules linked 
  2132.  
  2133.              5.  List of -b and -g definitions 
  2134.  
  2135.  
  2136.  
  2137.  
  2138.            The final step of the linking process is performed during the
  2139.         second pass of the input files.  As the xxx.rel files  are  read
  2140.         the code is relocated by substituting the physical addresses for
  2141.         the referenced symbols and areas and may be output in  Intel  or
  2142.         Motorola  formats.   The  number of files linked and symbols de-
  2143.         fined/referenced is limited by the processor space available  to
  2144.         build the area/symbol lists.  
  2145.  
  2146.  
  2147.         2.4  LINKER INPUT FORMAT 
  2148.  
  2149.  
  2150.            The  linkers'  input  object file is an ascii file containing
  2151.         the information needed by the linker  to  bind  multiple  object
  2152.         modules into a complete loadable memory image.  
  2153.  
  2154.         The object module contains the following designators:  
  2155.  
  2156.                 [XDQ][HL]
  2157.                         X       Hexidecimal radix
  2158.                         D       Decimal radix
  2159.                         Q       Octal radix
  2160.         
  2161.                         H       Most significant byte first
  2162.                         L       Least significant byte first
  2163.         
  2164.                 H       Header 
  2165.                 M       Module
  2166.                 A       Area
  2167.                 S       Symbol
  2168.                 T       Object code
  2169.                 R       Relocation information
  2170.                 P       Paging information
  2171.  
  2172.  
  2173.  
  2174.  
  2175.         THE LINKER                                              PAGE 2-5
  2176.         LINKER INPUT FORMAT
  2177.  
  2178.  
  2179.         2.4.1  Object Module Format 
  2180.  
  2181.  
  2182.            The  first  line  of  an object module contains the [XDQ][HL]
  2183.         format specifier (i.e.  XH indicates  a  hexidecimal  file  with
  2184.         most significant byte first) for the following designators.  
  2185.  
  2186.  
  2187.         2.4.2  Header Line 
  2188.  
  2189.                 H aa areas gg global symbols 
  2190.  
  2191.            The  header  line  specifies  the number of areas(aa) and the
  2192.         number of global symbols(gg) defined or referenced in  this  ob-
  2193.         ject module segment.  
  2194.  
  2195.  
  2196.         2.4.3  Module Line 
  2197.  
  2198.                 M name 
  2199.  
  2200.            The  module  line  specifies  the module name from which this
  2201.         header segment was assembled.  The module line will  not  appear
  2202.         if the .module directive was not used in the source program.  
  2203.  
  2204.  
  2205.         2.4.4  Symbol Line 
  2206.  
  2207.                 S string Defnnnn 
  2208.  
  2209.                         or 
  2210.  
  2211.                 S string Refnnnn 
  2212.  
  2213.            The  symbol line defines (Def) or references (Ref) the symbol
  2214.         'string' with the value nnnn.  The defined value is relative  to
  2215.         the  current area base address.  References to constants and ex-
  2216.         ternal global symbols will always appear before the  first  area
  2217.         definition.  References to external symbols will have a value of
  2218.         zero.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.         THE LINKER                                              PAGE 2-6
  2224.         LINKER INPUT FORMAT
  2225.  
  2226.  
  2227.         2.4.5  Area Line 
  2228.  
  2229.                 A label size ss flags ff 
  2230.  
  2231.            The  area  line  defines the area label, the size (ss) of the
  2232.         area in bytes, and the area flags (ff).  The area flags  specify
  2233.         the ABS, REL, CON, OVR, and PAG parameters:  
  2234.  
  2235.                 OVR/CON (0x04/0x00 i.e.  bit position 2) 
  2236.  
  2237.                 ABS/REL (0x08/0x00 i.e.  bit position 3) 
  2238.  
  2239.                 PAG (0x10 i.e.  bit position 4) 
  2240.  
  2241.  
  2242.         2.4.6  T Line 
  2243.  
  2244.                 T xx xx nn nn nn nn nn ...  
  2245.  
  2246.            The  T  line contains the assembled code output by the assem-
  2247.         bler with xx xx being the offset address from the  current  area
  2248.         base address and nn being the assembled instructions and data in
  2249.         byte format.  
  2250.  
  2251.  
  2252.         2.4.7  R Line 
  2253.  
  2254.                 R 0 0 nn nn n1 n2 xx xx ...  
  2255.  
  2256.            The R line provides the relocation information to the linker.
  2257.         The nn nn value is the current area index, i.e.  which area  the
  2258.         current  values  were  assembled.  Relocation information is en-
  2259.         coded in groups of 4 bytes:  
  2260.  
  2261.              1.  n1 is the relocation mode and object format 
  2262.                  1.  bit 0 word(0x00)/byte(0x01) 
  2263.                  2.  bit 1 relocatable area(0x00)/symbol(0x02) 
  2264.                  3.  bit 2 normal(0x00)/PC relative(0x04) relocation 
  2265.                  4.  bit  3  1-byte(0x00)/2-byte(0x08) object format for
  2266.                      byte data 
  2267.                  5.  bit 4 signed(0x00)/unsigned(0x10) byte data 
  2268.                  6.  bit 5 normal(0x00)/page '0'(0x20) reference 
  2269.                  7.  bit 6 normal(0x00)/page 'nnn'(0x40) reference 
  2270.  
  2271.              2.  n2  is  a byte index into the corresponding (i.e.  pre-
  2272.                  ceeding) T line data (i.e.  a pointer to the data to be
  2273.                  updated  by  the  relocation).   The T line data may be
  2274.                  1-byte or  2-byte  byte  data  format  or  2-byte  word
  2275.                  format.  
  2276.  
  2277.  
  2278.  
  2279.         THE LINKER                                              PAGE 2-7
  2280.         LINKER INPUT FORMAT
  2281.  
  2282.  
  2283.              3.  xx xx  is the area/symbol index for the area/symbol be-
  2284.                  ing referenced.  the corresponding area/symbol is found
  2285.                  in the header area/symbol lists.  
  2286.  
  2287.  
  2288.         The groups of 4 bytes are repeated for each item requiring relo-
  2289.         cation in the preceeding T line.  
  2290.  
  2291.  
  2292.         2.4.8  P Line 
  2293.  
  2294.                 P 0 0 nn nn n1 n2 xx xx 
  2295.  
  2296.            The  P  line provides the paging information to the linker as
  2297.         specified by a .setdp directive.  The format of  the  relocation
  2298.         information is identical to that of the R line.  The correspond-
  2299.         ing T line has the following information:  
  2300.                 T xx xx aa aa bb bb 
  2301.  
  2302.            Where  aa aa is the area reference number which specifies the
  2303.         selected page area and bb bb is the base address  of  the  page.
  2304.         bb bb will require relocation processing if the 'n1 n2 xx xx' is
  2305.         specified in the P line.  The linker will verify that  the  base
  2306.         address is on a 256 byte boundary and that the page length of an
  2307.         area defined with the PAG type is not larger than 256 bytes.  
  2308.  
  2309.            The  linker  defaults any direct page references to the first
  2310.         area defined in the input REL file.  All ASxxxx assemblers  will
  2311.         specify the _CODE area first, making this the default page area. 
  2312.  
  2313.  
  2314.         2.5  LINKER ERROR MESSAGES 
  2315.  
  2316.  
  2317.            The linker provides detailed error messages allowing the pro-
  2318.         grammer to quickly find the errant code.   As  the  linker  com-
  2319.         pletes  pass 1  over  the  input  file(s)  it  reports  any page
  2320.         boundary or page length errors as follows:  
  2321.  
  2322.         ?ASlink-W-Paged Area PAGE0 Boundary Error
  2323.         
  2324.         and/or
  2325.         
  2326.         ?ASlink-W-Paged Area PAGE0 Length Error
  2327.  
  2328.         where PAGE0 is the paged area.  
  2329.  
  2330.            During  Pass  two the linker reads the T, R, and P lines per-
  2331.         forming the necessary relocations and  outputting  the  absolute
  2332.         code.  Various errors may be reported during this process 
  2333.  
  2334.  
  2335.         THE LINKER                                              PAGE 2-8
  2336.         LINKER ERROR MESSAGES
  2337.  
  2338.  
  2339.         The P line processing can produce only one possible error:  
  2340.  
  2341.         ?ASlink-W-Page Definition Boundary Error
  2342.                  file        module      pgarea      pgoffset
  2343.           PgDef  t6809l      t6809l      PAGE0       0001
  2344.  
  2345.         The error message specifies the file and module where the .setdp
  2346.         direct was issued and indicates  the  page  area  and  the  page
  2347.         offset value determined after relocation.  
  2348.  
  2349.  
  2350.         The R line processing produces various errors:  
  2351.  
  2352.         ?ASlink-W-Byte PCR relocation error for symbol  bra2
  2353.                  file        module      area        offset
  2354.           Refby  t6809l      t6809l      TEST        00FE
  2355.           Defin  tconst      tconst      .  .ABS.    0080
  2356.  
  2357.         ?ASlink-W-Unsigned Byte error for symbol  two56
  2358.                  file        module      area        offset
  2359.           Refby  t6800l      t6800l      DIRECT      0015
  2360.           Defin  tconst      tconst      .  .ABS.    0100
  2361.  
  2362.         ?ASlink-W-Page0 relocation error for symbol  ltwo56
  2363.                  file        module      area        offset
  2364.           Refby  t6800l      t6800l      DIRECT      000D
  2365.           Defin  tconst      tconst      DIRECT      0100
  2366.  
  2367.         ?ASlink-W-Page Mode relocation error for symbol  two56
  2368.                  file        module      area        offset
  2369.           Refby  t6809l      t6809l      DIRECT      0005
  2370.           Defin  tconst      tconst      .  .ABS.    0100
  2371.  
  2372.         ?ASlink-W-Page Mode relocation error
  2373.                  file        module      area        offset
  2374.           Refby  t           Pagetest    PROGRAM     0006
  2375.           Defin  t           Pagetest    DIRECT      0100
  2376.  
  2377.         These  error messages specify the file, module, area, and offset
  2378.         within the area of the code  referencing  (Refby)  and  defining
  2379.         (Defin) the symbol.  If the symbol is defined in the same module
  2380.         as the reference the linker is unable to report the symbol name.
  2381.         The  assembler  listing file(s) should be examined at the offset
  2382.         from the specified area to located the offending code.  
  2383.  
  2384.            The errors are:  
  2385.  
  2386.              1.  The  byte PCR error is caused by exceeding the pc rela-
  2387.                  tive byte branch range.  
  2388.  
  2389.              2.  The Unsigned byte error indicates an indexing value was
  2390.                  negative or larger than 255.  
  2391.  
  2392.  
  2393.         THE LINKER                                              PAGE 2-9
  2394.         LINKER ERROR MESSAGES
  2395.  
  2396.  
  2397.              3.  The  Page0  error is generated if the direct page vari-
  2398.                  able is not in the page0 range of 0 to 255.  
  2399.  
  2400.              4.  The page mode error is generated if the direct variable
  2401.                  is not within the current direct page (6809).  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.                                     CHAPTER 3
  2418.  
  2419.                            BUILDING ASXXXX AND ASLINK
  2420.  
  2421.  
  2422.  
  2423.  
  2424.            The assemblers and linker have been successfully compiled us-
  2425.         ing  the  DECUS C  (PDP-11)  compiler  (patch  level   9)   with
  2426.         RT-11/TSX+,  Eyring  Research  Institute,  Inc.   PDOS (680x0) C
  2427.         V5.4b compiler, and with  Borland's  Turbo C  V1.5  with  MS-DOS
  2428.         (80x86).  
  2429.  
  2430.            The  device  specific  header  file  (i.e.  m6800.h, m6801.h,
  2431.         etc.) contains the DECUS C 'BUILD' directives for  generating  a
  2432.         command  file to compile, assemble, and link the necessary files
  2433.         to prepare an executable image for a particular assembler.  
  2434.  
  2435.  
  2436.         3.1  BUILDING AN ASSEMBLER 
  2437.  
  2438.  
  2439.            The  building  of  a typical assembler (6809 for example) re-
  2440.         quires the following files:  
  2441.  
  2442.              1.  M6809.H 
  2443.              2.  M09EXT.C 
  2444.              3.  M09MCH.C 
  2445.              4.  M09ADR.C 
  2446.              5.  M09PST.C 
  2447.              6.  ASM.H 
  2448.              7.  ASMAIN.C 
  2449.              8.  ASLEX.C 
  2450.              9.  ASSYM.C 
  2451.             10.  ASSUBR.C 
  2452.             11.  ASEXPR.C 
  2453.             12.  ASDATA.C 
  2454.             13.  ASLIST.C 
  2455.             14.  ASOUT.C 
  2456.  
  2457.  
  2458.            The  first  five  files are the 6809 processor dependent sec-
  2459.         tions which contain the following:  
  2460.  
  2461.  
  2462.  
  2463.         BUILDING ASXXXX AND ASLINK                              PAGE 3-2
  2464.         BUILDING AN ASSEMBLER
  2465.  
  2466.  
  2467.              1.  m6809.h -  header  file containing the machine specific
  2468.                  definitions of constants,  variables,  structures,  and
  2469.                  types 
  2470.  
  2471.              2.  m09ext -  device  description, byte order, and file ex-
  2472.                  tension information 
  2473.  
  2474.              3.  m09pst -  a  table of the assembler general directives,
  2475.                  special device directives, and assembler mnemonics with
  2476.                  associated operation codes 
  2477.  
  2478.              4.  m09mch / m09adr -  machine specific code for processing
  2479.                  the device mnemonics,  addressing  modes,  and  special
  2480.                  directives 
  2481.  
  2482.  
  2483.            The  remaining nine files provide the device independent sec-
  2484.         tions which handle the  details  of  file  input/output,  symbol
  2485.         table  generation,  program/data areas, expression analysis, and
  2486.         assembler directive processing.  
  2487.  
  2488.            The  assembler defaults to the case sensitive mode.  This may
  2489.         be altered by changing the case sensitivity flag in asm.h to 
  2490.  
  2491.                 /*
  2492.                  * Case Sensitivity Flag
  2493.                  */
  2494.                 #define CASE_SENSITIVE  0
  2495.  
  2496.            The  assemblers  and  linker should be compiled with the same
  2497.         case sensitivity option.  
  2498.  
  2499.            The  DECUS C  build files are asxxxx.bld and the Turbo C pro-
  2500.         ject files are asxxxx.prj.  
  2501.  
  2502.  
  2503.         3.2  BUILDING ASLINK 
  2504.  
  2505.  
  2506.            The building of the linker requires the following files:  
  2507.  
  2508.              1.  ASLINK.H 
  2509.              2.  LKMAIN.C 
  2510.              3.  LKLEX.C 
  2511.              4.  LKAREA.C 
  2512.              5.  LKHEAD.C 
  2513.              6.  LKSYM.C 
  2514.              7.  LKEVAL.C 
  2515.              8.  LKDATA.C 
  2516.              9.  LKLIST.C 
  2517.             10.  LKRLOC.C 
  2518.  
  2519.  
  2520.         BUILDING ASXXXX AND ASLINK                              PAGE 3-3
  2521.         BUILDING ASLINK
  2522.  
  2523.  
  2524.             11.  LKS19.C 
  2525.             12.  LKIHX.C 
  2526.  
  2527.  
  2528.            The  linker defaults to the case sensitive mode.  This may be
  2529.         altered by changing the case sensitivity flag in aslink.h to 
  2530.  
  2531.                 /*
  2532.                  * Case Sensitivity Flag
  2533.                  */
  2534.                 #define CASE_SENSITIVE  0
  2535.  
  2536.            The  linker  and  assemblers should be compiled with the same
  2537.         case sensitivity option.  
  2538.  
  2539.            The  DECUS C build file is aslink.bld and the Turbo C project
  2540.         file is aslink.prj.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.                                    APPENDIX A
  2556.  
  2557.                                 AS6800 ASSEMBLER
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.         A.1  6800 REGISTER SET 
  2564.  
  2565.         The following is a list of the 6800 registers used by AS6800:  
  2566.  
  2567.                 a,b     -       8-bit accumulators
  2568.                 x       -       index register
  2569.  
  2570.  
  2571.         A.2  6800 INSTRUCTION SET 
  2572.  
  2573.  
  2574.            The following tables list all 6800/6802/6808 mnemonics recog-
  2575.         nized by the AS6800 assembler.  The designation [] refers  to  a
  2576.         required addressing mode argument.  The following list specifies
  2577.         the format for each addressing mode supported by AS6800:  
  2578.  
  2579.                 #data           immediate data
  2580.                                 byte or word data
  2581.         
  2582.                 *dir            direct page addressing
  2583.                                 (see .setdp directive)
  2584.                                 0 <= dir <= 255 
  2585.         
  2586.                 ,x              register indirect addressing
  2587.                                 zero offset
  2588.         
  2589.                 offset,x        register indirect addressing
  2590.                                 0 <= offset <= 255
  2591.         
  2592.                 ext             extended addressing
  2593.         
  2594.                 label           branch label
  2595.  
  2596.         The  terms  data, dir, offset, ext, and label may all be expres-
  2597.         sions.  
  2598.  
  2599.  
  2600.  
  2601.         AS6800 ASSEMBLER                                        PAGE A-2
  2602.         6800 INSTRUCTION SET
  2603.  
  2604.  
  2605.            Note  that  not all addressing modes are valid with every in-
  2606.         struction, refer to the 6800 technical data for valid modes.  
  2607.  
  2608.  
  2609.         A.2.1  Inherent Instructions 
  2610.  
  2611.                 aba                     cba
  2612.                 clc                     cli
  2613.                 clv                     daa
  2614.                 des                     dex
  2615.                 ins                     inx
  2616.                 nop                     rti
  2617.                 rts                     sba
  2618.                 sec                     sei
  2619.                 sev                     swi
  2620.                 tab                     tap
  2621.                 tba                     tpa
  2622.                 tsx                     txs
  2623.                 wai
  2624.         
  2625.                 psha                    pshb
  2626.                 psh a                   psh b
  2627.                 pula                    pulb
  2628.                 pul a                   pul b
  2629.  
  2630.  
  2631.         A.2.2  Branch Instructions 
  2632.  
  2633.                 bra     label           bhi     label
  2634.                 bls     label           bcc     label
  2635.                 bhs     label           bcs     label
  2636.                 blo     label           bne     label
  2637.                 beq     label           bvc     label
  2638.                 bvs     label           bpl     label
  2639.                 bmi     label           bge     label
  2640.                 blt     label           bgt     label
  2641.                 ble     label           bsr     label
  2642.  
  2643.  
  2644.         AS6800 ASSEMBLER                                        PAGE A-3
  2645.         6800 INSTRUCTION SET
  2646.  
  2647.  
  2648.         A.2.3  Single Operand Instructions 
  2649.  
  2650.                 asla                    aslb
  2651.                 asl a                   asl b
  2652.                 asl     []
  2653.         
  2654.                 asra                    asrb
  2655.                 asr a                   asr b
  2656.                 asr     []
  2657.         
  2658.                 clra                    clrb
  2659.                 clr a                   clr b
  2660.                 clr     []
  2661.         
  2662.                 coma                    comb
  2663.                 com a                   com b
  2664.                 com     []
  2665.         
  2666.                 deca                    decb
  2667.                 dec a                   dec b
  2668.                 dec     []
  2669.         
  2670.                 inca                    incb
  2671.                 inc a                   inc b
  2672.                 inc     []
  2673.         
  2674.                 lsla                    lslb
  2675.                 lsl a                   lsl b
  2676.                 lsl     []
  2677.         
  2678.                 lsra                    lsrb
  2679.                 lsr a                   lsr b
  2680.                 lsr     []
  2681.         
  2682.                 nega                    negb
  2683.                 neg a                   neg b
  2684.                 neg     []
  2685.         
  2686.                 rola                    rolb
  2687.                 rol a                   rol b
  2688.                 rol     []
  2689.         
  2690.                 rora                    rorb
  2691.                 ror a                   ror b
  2692.                 ror     []
  2693.         
  2694.                 tsta                    tstb
  2695.                 tst a                   tst b
  2696.                 tst     []
  2697.  
  2698.  
  2699.         AS6800 ASSEMBLER                                        PAGE A-4
  2700.         6800 INSTRUCTION SET
  2701.  
  2702.  
  2703.         A.2.4  Double Operand Instructions 
  2704.  
  2705.                 adca    []              adcb    []
  2706.                 adc a   []              adc b   []
  2707.         
  2708.                 adda    []              addb    []
  2709.                 add a   []              add b   []
  2710.         
  2711.                 anda    []              andb    []
  2712.                 and a   []              and b   []
  2713.         
  2714.                 bita    []              bitb    []
  2715.                 bit a   []              bit b   []
  2716.         
  2717.                 cmpa    []              cmpb    []
  2718.                 cmp a   []              cmp b   []
  2719.         
  2720.                 eora    []              eorb    []
  2721.                 eor a   []              eor b   []
  2722.         
  2723.                 ldaa    []              ldab    []
  2724.                 lda a   []              lda b   []
  2725.         
  2726.                 oraa    []              orab    []
  2727.                 ora a   []              ora b   []
  2728.         
  2729.                 sbca    []              sbcb    []
  2730.                 sbc a   []              sbc b   []
  2731.         
  2732.                 staa    []              stab    []
  2733.                 sta a   []              sta b   []
  2734.         
  2735.                 suba    []              subb    []
  2736.                 sub a   []              sub b   []
  2737.  
  2738.  
  2739.         A.2.5  Jump and Jump to Subroutine Instructions 
  2740.  
  2741.                 jmp     []              jsr     []
  2742.  
  2743.  
  2744.  
  2745.  
  2746.         AS6800 ASSEMBLER                                        PAGE A-5
  2747.         6800 INSTRUCTION SET
  2748.  
  2749.  
  2750.         A.2.6  Long Register Instructions 
  2751.  
  2752.                 cpx     []
  2753.                 lds     []              sts     []
  2754.                 ldx     []              stx     []
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.                                    APPENDIX B
  2770.  
  2771.                                 AS6801 ASSEMBLER
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.         B.1  .hd6303 DIRECTIVE 
  2778.  
  2779.         Format:  
  2780.  
  2781.                 .hd6303 
  2782.  
  2783.         The  .hd6303 directive enables processing of the HD6303 specific
  2784.         mnemonics not included in  the  6801  instruction  set.   HD6303
  2785.         mnemonics  encountered  without  the  .hd6303  directive will be
  2786.         flagged with an 'o' error.  
  2787.  
  2788.  
  2789.         B.2  6801 REGISTER SET 
  2790.  
  2791.         The following is a list of the 6801 registers used by AS6801:  
  2792.  
  2793.                 a,b     -       8-bit accumulators
  2794.                 d       -       16-bit accumulator <a:b>
  2795.                 x       -       index register
  2796.  
  2797.  
  2798.         B.3  6801 INSTRUCTION SET 
  2799.  
  2800.  
  2801.            The  following tables list all 6801/6303 mnemonics recognized
  2802.         by the AS6801 assembler.  The designation []  refers  to  a  re-
  2803.         quired  addressing  mode argument.  The following list specifies
  2804.         the format for each addressing mode supported by AS6801:  
  2805.  
  2806.                 #data           immediate data
  2807.                                 byte or word data
  2808.         
  2809.                 *dir            direct page addressing
  2810.                                 (see .setdp directive)
  2811.                                 0 <= dir <= 255 
  2812.         
  2813.  
  2814.  
  2815.         AS6801 ASSEMBLER                                        PAGE B-2
  2816.         6801 INSTRUCTION SET
  2817.  
  2818.  
  2819.                 ,x              register indirect addressing
  2820.                                 zero offset
  2821.         
  2822.                 offset,x        register indirect addressing
  2823.                                 0 <= offset <= 255
  2824.         
  2825.                 ext             extended addressing
  2826.         
  2827.                 label           branch label
  2828.  
  2829.         The  terms  data, dir, offset, ext, and label may all be expres-
  2830.         sions.  
  2831.  
  2832.            Note  that  not all addressing modes are valid with every in-
  2833.         struction, refer to  the  6801/6303  technical  data  for  valid
  2834.         modes.  
  2835.  
  2836.  
  2837.         B.3.1  Inherent Instructions 
  2838.  
  2839.                 aba             abx
  2840.                 cba             clc
  2841.                 cli             clv
  2842.                 daa             des
  2843.                 dex             ins
  2844.                 inx             mul
  2845.                 nop             rti
  2846.                 rts             sba
  2847.                 sec             sei
  2848.                 sev             swi
  2849.                 tab             tap
  2850.                 tba             tpa
  2851.                 tsx             txs
  2852.                 wai
  2853.  
  2854.  
  2855.         B.3.2  Branch Instructions 
  2856.  
  2857.                 bra     label           brn     label
  2858.                 bhi     label           bls     label
  2859.                 bcc     label           bhs     label
  2860.                 bcs     label           blo     label
  2861.                 bne     label           beq     label
  2862.                 bvc     label           bvs     label
  2863.                 bpl     label           bmi     label
  2864.                 bge     label           blt     label
  2865.                 bgt     label           ble     label
  2866.                 bsr     label
  2867.  
  2868.  
  2869.         AS6801 ASSEMBLER                                        PAGE B-3
  2870.         6801 INSTRUCTION SET
  2871.  
  2872.  
  2873.         B.3.3  Single Operand Instructions 
  2874.  
  2875.                 asla            aslb            asld
  2876.                 asl a           asl b           asl d
  2877.                 asl     []
  2878.         
  2879.                 asra            asrb
  2880.                 asr a           asr b
  2881.                 asr     []
  2882.         
  2883.                 clra            clrb
  2884.                 clr a           clr b
  2885.                 clr     []
  2886.         
  2887.                 coma            comb
  2888.                 com a           com b
  2889.                 com     []
  2890.         
  2891.                 deca            decb
  2892.                 dec a           dec b
  2893.                 dec     []
  2894.         
  2895.                 eora            eorb
  2896.                 eor a           eor b
  2897.                 eor     []
  2898.         
  2899.                 inca            incb
  2900.                 inc a           inc b
  2901.                 inc     []
  2902.         
  2903.                 lsla            lslb            lsld
  2904.                 lsl a           lsl b           lsl d
  2905.                 lsl     []
  2906.         
  2907.                 lsra            lsrb            lsrd
  2908.                 lsr a           lsr b           lsr d
  2909.                 lsr     []
  2910.         
  2911.                 nega            negb
  2912.                 neg a           neg b
  2913.                 neg     []
  2914.         
  2915.                 psha            pshb            pshx
  2916.                 psh a           psh b           psh x
  2917.         
  2918.                 pula            pulb            pulx
  2919.                 pul a           pul b           pul x
  2920.         
  2921.                 rola            rolb
  2922.                 rol a           rol b
  2923.                 rol     []
  2924.         
  2925.  
  2926.  
  2927.         AS6801 ASSEMBLER                                        PAGE B-4
  2928.         6801 INSTRUCTION SET
  2929.  
  2930.  
  2931.                 rora            rorb
  2932.                 ror a           ror b
  2933.                 ror     []
  2934.         
  2935.                 tsta            tstb
  2936.                 tst a           tst b
  2937.                 tst     []
  2938.  
  2939.  
  2940.         B.3.4  Double Operand Instructions 
  2941.  
  2942.                 adca    []      adcb    []
  2943.                 adc a   []      adc b   []
  2944.         
  2945.                 adda    []      addb    []      addd    []
  2946.                 add a   []      add b   []      add d   []
  2947.         
  2948.                 anda    []      andb    []
  2949.                 and a   []      and b   []
  2950.         
  2951.                 bita    []      bitb    []
  2952.                 bit a   []      bit b   []
  2953.         
  2954.                 cmpa    []      cmpb    []
  2955.                 cmp a   []      cmp b   []
  2956.         
  2957.                 ldaa    []      ldab    []
  2958.                 lda a   []      lda b   []
  2959.         
  2960.                 oraa    []      orab    []
  2961.                 ora a   []      ora b   []
  2962.         
  2963.                 sbca    []      sbcb    []
  2964.                 sbc a   []      sbc b   []
  2965.         
  2966.                 staa    []      stab    []
  2967.                 sta a   []      sta b   []
  2968.         
  2969.                 suba    []      subb    []      subd    []
  2970.                 sub a   []      sub b   []      sub d   []
  2971.  
  2972.  
  2973.  
  2974.  
  2975.         AS6801 ASSEMBLER                                        PAGE B-5
  2976.         6801 INSTRUCTION SET
  2977.  
  2978.  
  2979.         B.3.5  Jump and Jump to Subroutine Instructions 
  2980.  
  2981.                 jmp     []      jsr     []
  2982.  
  2983.  
  2984.         B.3.6  Long Register Instructions 
  2985.  
  2986.                 cpx     []      ldd     []
  2987.                 lds     []      ldx     []
  2988.                 std     []      sts     []
  2989.                 stx     []
  2990.  
  2991.  
  2992.         B.3.7  6303 Specific Instructions 
  2993.  
  2994.                 aim     #data, []       eim     #data, []
  2995.                 oim     #data, []       tim     #data, []
  2996.         
  2997.                 xgdx            slp
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.                                    APPENDIX C
  3013.  
  3014.                                 AS6804 ASSEMBLER
  3015.  
  3016.  
  3017.  
  3018.  
  3019.            Requires the .setdp directive to specify the ram area.  
  3020.  
  3021.  
  3022.         C.1  6804 REGISTER SET 
  3023.  
  3024.         The following is a list of the 6804 registers used by AS6804:  
  3025.  
  3026.                 x,y     -       index registers
  3027.  
  3028.  
  3029.         C.2  6804 INSTRUCTION SET 
  3030.  
  3031.  
  3032.            The  following  tables  list all 6804 mnemonics recognized by
  3033.         the AS6804 assembler.  The designation [] refers to  a  required
  3034.         addressing  mode  argument.   The  following  list specifies the
  3035.         format for each addressing mode supported by AS6804:  
  3036.  
  3037.                 #data           immediate data
  3038.                                 byte or word data
  3039.         
  3040.                 ,x              register indirect addressing
  3041.         
  3042.                 dir             direct addressing
  3043.                                 (see .setdp directive)
  3044.                                 0 <= dir <= 255
  3045.         
  3046.                 ext             extended addressing
  3047.         
  3048.                 label           branch label
  3049.  
  3050.         The  terms data, dir, and ext may be expressions.  The label for
  3051.         the short branchs beq, bne, bcc, and bcs must not be external.  
  3052.  
  3053.            Note  that  not all addressing modes are valid with every in-
  3054.         struction, refer to the 6804 technical data for valid modes.  
  3055.  
  3056.  
  3057.         AS6804 ASSEMBLER                                        PAGE C-2
  3058.         6804 INSTRUCTION SET
  3059.  
  3060.  
  3061.         C.2.1  Inherent Instructions 
  3062.  
  3063.                 coma            decx
  3064.                 decy            incx
  3065.                 incy            rola
  3066.                 rti             rts
  3067.                 stop            tax
  3068.                 tay             txa
  3069.                 tya             wait
  3070.  
  3071.  
  3072.         C.2.2  Branch Instructions 
  3073.  
  3074.                 bne     label           beq     label
  3075.                 bcc     label           bcs     label
  3076.  
  3077.  
  3078.         C.2.3  Single Operand Instructions 
  3079.  
  3080.                 add     []
  3081.                 and     []
  3082.                 cmp     []
  3083.                 dec     []
  3084.                 inc     []
  3085.                 lda     []
  3086.                 sta     []
  3087.                 sub     []
  3088.  
  3089.  
  3090.         C.2.4  Jump and Jump to Subroutine Instructions 
  3091.  
  3092.                 jsr     []
  3093.                 jmp     []
  3094.  
  3095.  
  3096.         C.2.5  Bit Test Instructions 
  3097.  
  3098.                 brclr   #data,[],label
  3099.                 brset   #data,[],label
  3100.         
  3101.                 bclr    #label,[]
  3102.                 bset    #label,[]
  3103.  
  3104.  
  3105.  
  3106.  
  3107.         AS6804 ASSEMBLER                                        PAGE C-3
  3108.         6804 INSTRUCTION SET
  3109.  
  3110.  
  3111.         C.2.6  Load Immediate data Instruction 
  3112.  
  3113.                 mvi     [],#data
  3114.  
  3115.  
  3116.         C.2.7  6804 Derived Instructions 
  3117.  
  3118.                 asla
  3119.                 bam     label
  3120.                 bap     label
  3121.                 bxmi    label
  3122.                 bxpl    label
  3123.                 bymi    label
  3124.                 bypl    label
  3125.                 clra
  3126.                 clrx
  3127.                 clry
  3128.                 deca
  3129.                 decx
  3130.                 decy
  3131.                 inca
  3132.                 incx
  3133.                 incy
  3134.                 ldxi    #data
  3135.                 ldyi    #data
  3136.                 nop
  3137.                 tax
  3138.                 tay
  3139.                 txa
  3140.                 tya
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.                                    APPENDIX D
  3156.  
  3157.                                 AS6805 ASSEMBLER
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.         D.1  6805 REGISTER SET 
  3164.  
  3165.         The following is a list of the 6805 registers used by AS6805:  
  3166.  
  3167.                 a       -       8-bit accumulator
  3168.                 x       -       index register
  3169.  
  3170.  
  3171.         D.2  6805 INSTRUCTION SET 
  3172.  
  3173.  
  3174.            The  following  tables  list all 6805 mnemonics recognized by
  3175.         the AS6805 assembler.  The designation [] refers to  a  required
  3176.         addressing  mode  argument.   The  following  list specifies the
  3177.         format for each addressing mode supported by AS6805:  
  3178.  
  3179.                 #data           immediate data
  3180.                                 byte or word data
  3181.         
  3182.                 *dir            direct page addressing
  3183.                                 (see .setdp directive)
  3184.                                 0 <= dir <= 255 
  3185.         
  3186.                 ,x              register indirect addressing
  3187.                                 zero offset
  3188.         
  3189.                 offset,x        register indirect addressing
  3190.                                   0 <= offset <= 255   --- byte mode
  3191.                                 256 <= offset <= 65535 --- word mode
  3192.                                 (an externally defined offset uses the
  3193.                                  word mode)
  3194.         
  3195.                 ext             extended addressing
  3196.         
  3197.                 label           branch label
  3198.  
  3199.  
  3200.  
  3201.         AS6805 ASSEMBLER                                        PAGE D-2
  3202.         6805 INSTRUCTION SET
  3203.  
  3204.  
  3205.         The terms data, dir, offset, and ext may all be expressions.  
  3206.  
  3207.            Note  that  not all addressing modes are valid with every in-
  3208.         struction, refer to the 6805 technical data for valid modes.  
  3209.  
  3210.  
  3211.         D.2.1  Control Instructions 
  3212.  
  3213.                 clc             cli
  3214.                 nop             rsp
  3215.                 rti             rts
  3216.                 sec             sei
  3217.                 stop            swi
  3218.                 tax             txa
  3219.                 wait
  3220.  
  3221.  
  3222.         D.2.2  Bit Manipulation Instructions 
  3223.  
  3224.                 brset   #data,*dir,label
  3225.                 brclr   #data,*dir,label
  3226.         
  3227.                 bset    #data,*dir
  3228.                 bclr    #data,*dir
  3229.  
  3230.  
  3231.         D.2.3  Branch Instructions 
  3232.  
  3233.                 bra     label           brn     label
  3234.                 bhi     label           bls     label
  3235.                 bcc     label           bcs     label
  3236.                 bne     label           beq     label
  3237.                 bhcc    label           bhcs    label
  3238.                 bpl     label           bmi     label
  3239.                 bmc     label           bms     label
  3240.                 bil     label           bih     label
  3241.                 bsr     label
  3242.  
  3243.  
  3244.         AS6805 ASSEMBLER                                        PAGE D-3
  3245.         6805 INSTRUCTION SET
  3246.  
  3247.  
  3248.         D.2.4  Read-Modify-Write Instructions 
  3249.  
  3250.                 nega            negx
  3251.                 neg     []
  3252.         
  3253.                 coma            comx
  3254.                 com     []
  3255.         
  3256.                 lsra            lsrx
  3257.                 lsr     []
  3258.         
  3259.                 rora            rorx
  3260.                 ror     []
  3261.         
  3262.                 asra            asrx
  3263.                 asr     []
  3264.         
  3265.                 lsla            lslx
  3266.                 lsl     []
  3267.         
  3268.                 rola            rolx
  3269.                 rol     []
  3270.         
  3271.                 deca            decx
  3272.                 dec     []
  3273.         
  3274.                 inca            incx
  3275.                 inc     []
  3276.         
  3277.                 tsta            tstx
  3278.                 tst     []
  3279.         
  3280.                 clra            clrx
  3281.                 clr     []
  3282.  
  3283.  
  3284.         D.2.5  Register\Memory Instructions 
  3285.  
  3286.                 sub     []              cmp     []
  3287.                 sbc     []              cpx     []
  3288.                 and     []              bit     []
  3289.                 lda     []              sta     []
  3290.                 eor     []              adc     []
  3291.                 ora     []              add     []
  3292.                 ldx     []              stx     []
  3293.  
  3294.  
  3295.         AS6805 ASSEMBLER                                        PAGE D-4
  3296.         6805 INSTRUCTION SET
  3297.  
  3298.  
  3299.         D.2.6  Jump and Jump to Subroutine Instructions 
  3300.  
  3301.                 jmp     []              jsr     []
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.                                    APPENDIX E
  3317.  
  3318.                                 AS6809 ASSEMBLER
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.         E.1  6809 REGISTER SET 
  3325.  
  3326.         The following is a list of the 6809 registers used by AS6809:  
  3327.  
  3328.                 a,b     -       8-bit accumulators
  3329.                 d       -       16-bit accumulator <a:b>
  3330.                 x,y     -       index registers
  3331.                 s,u     -       stack pointers
  3332.                 pc      -       program counter
  3333.                 cc      -       condition code
  3334.                 dp      -       direct page
  3335.  
  3336.  
  3337.         E.2  6809 INSTRUCTION SET 
  3338.  
  3339.  
  3340.            The  following  tables  list all 6809 mnemonics recognized by
  3341.         the AS6809 assembler.  The designation [] refers to  a  required
  3342.         addressing  mode  argument.   The  following  list specifies the
  3343.         format for each addressing mode supported by AS6809:  
  3344.  
  3345.                 #data           immediate data
  3346.                                 byte or word data
  3347.         
  3348.                 *dir            direct page addressing
  3349.                                 (see .setdp directive)
  3350.                                 0 <= dir <= 255 
  3351.         
  3352.                 label           branch label
  3353.         
  3354.                 r,r1,r2         registers
  3355.                                 cc,a,b,d,dp,x,y,s,u,pc
  3356.         
  3357.                 ,-x     ,--x    register indexed
  3358.                                 autodecrement
  3359.         
  3360.  
  3361.  
  3362.         AS6809 ASSEMBLER                                        PAGE E-2
  3363.         6809 INSTRUCTION SET
  3364.  
  3365.  
  3366.                 ,x+     ,x++    register indexed
  3367.                                 autoincrement
  3368.         
  3369.                 ,x              register indexed addressing
  3370.                                 zero offset
  3371.         
  3372.                 offset,x        register indexed addressing
  3373.                                    -16 <= offset <= 15    ---  5-bit
  3374.                                   -128 <= offset <= -17   ---  8-bit
  3375.                                     16 <= offset <= 127   ---  8-bit
  3376.                                 -32768 <= offset <= -129  --- 16-bit
  3377.                                    128 <= offset <= 32767 --- 16-bit
  3378.                                 (external definition of offset
  3379.                                  uses 16-bit mode)
  3380.         
  3381.                 a,x             accumulator offset indexed addressing
  3382.         
  3383.                 ext             extended addressing
  3384.         
  3385.                 ext,pc          pc addressing ( pc <- pc + ext )
  3386.         
  3387.                 ext,pcr         pc relative addressing
  3388.                                 
  3389.                 [,--x]          register indexed indirect
  3390.                                 autodecrement
  3391.         
  3392.                 [,x++]          register indexed indirect
  3393.                                 autoincrement
  3394.         
  3395.                 [,x]            register indexed indirect addressing
  3396.                                 zero offset
  3397.         
  3398.                 [offset,x]      register indexed indirect addressing
  3399.                                   -128 <= offset <= 127   ---  8-bit
  3400.                                 -32768 <= offset <= -129  --- 16-bit
  3401.                                    128 <= offset <= 32767 --- 16-bit
  3402.                                 (external definition of offset
  3403.                                  uses 16-bit mode)
  3404.         
  3405.                 [a,x]           accumulator offset indexed
  3406.                                 indirect addressing
  3407.         
  3408.                 [ext]           extended indirect addressing
  3409.         
  3410.                 [ext,pc]        pc indirect addressing
  3411.                                 ( [pc <- pc + ext] )
  3412.         
  3413.                 [ext,pcr]       pc relative indirect addressing
  3414.  
  3415.         The  terms  data, dir, label, offset, and ext may all be expres-
  3416.         sions.  
  3417.  
  3418.  
  3419.  
  3420.         AS6809 ASSEMBLER                                        PAGE E-3
  3421.         6809 INSTRUCTION SET
  3422.  
  3423.  
  3424.            Note  that  not all addressing modes are valid with every in-
  3425.         struction, refer to the 6809 technical data for valid modes.  
  3426.  
  3427.  
  3428.         E.2.1  Inherent Instructions 
  3429.  
  3430.                 abx             daa
  3431.                 mul             nop
  3432.                 rti             rts
  3433.                 sex             swi
  3434.                 swi1            swi2
  3435.                 swi3            sync
  3436.  
  3437.  
  3438.         E.2.2  Short Branch Instructions 
  3439.  
  3440.                 bcc     label           bcs     label
  3441.                 beq     label           bge     label
  3442.                 bgt     label           bhi     label
  3443.                 bhis    label           bhs     label
  3444.                 ble     label           blo     label
  3445.                 blos    label           bls     label
  3446.                 blt     label           bmi     label
  3447.                 bne     label           bpl     label
  3448.                 bra     label           brn     label
  3449.                 bvc     label           bvs     label
  3450.                 bsr     label
  3451.  
  3452.  
  3453.         E.2.3  Long Branch Instructions 
  3454.  
  3455.                 lbcc    label           lbcs    label
  3456.                 lbeq    label           lbge    label
  3457.                 lbgt    label           lbhi    label
  3458.                 lbhis   label           lbhs    label
  3459.                 lble    label           lblo    label
  3460.                 lblos   label           lbls    label
  3461.                 lblt    label           lbmi    label
  3462.                 lbne    label           lbpl    label
  3463.                 lbra    label           lbrn    label
  3464.                 lbvc    label           lbvs    label
  3465.                 lbsr    label
  3466.  
  3467.  
  3468.         AS6809 ASSEMBLER                                        PAGE E-4
  3469.         6809 INSTRUCTION SET
  3470.  
  3471.  
  3472.         E.2.4  Single Operand Instructions 
  3473.  
  3474.                 asla            aslb
  3475.                 asl     []
  3476.         
  3477.                 asra            asrb
  3478.                 asr     []
  3479.         
  3480.                 clra            clrb
  3481.                 clr     []
  3482.         
  3483.                 coma            comb
  3484.                 com     []
  3485.         
  3486.                 deca            decb
  3487.                 dec     []
  3488.         
  3489.                 inca            incb
  3490.                 inc     []
  3491.         
  3492.                 lsla            lslb
  3493.                 lsl     []
  3494.         
  3495.                 lsra            lsrb
  3496.                 lsr     []
  3497.         
  3498.                 nega            negb
  3499.                 neg     []
  3500.         
  3501.                 rola            rolb
  3502.                 rol     []
  3503.         
  3504.                 rora            rorb
  3505.                 ror     []
  3506.         
  3507.                 tsta            tstb
  3508.                 tst     []
  3509.  
  3510.  
  3511.         AS6809 ASSEMBLER                                        PAGE E-5
  3512.         6809 INSTRUCTION SET
  3513.  
  3514.  
  3515.         E.2.5  Double Operand Instructions 
  3516.  
  3517.                 adca    []              adcb    []
  3518.         
  3519.                 adda    []              addb    []
  3520.         
  3521.                 anda    []              andb    []
  3522.         
  3523.                 bita    []              bitb    []
  3524.         
  3525.                 cmpa    []              cmpb    []
  3526.         
  3527.                 eora    []              eorb    []
  3528.         
  3529.                 lda     []              ldb     []
  3530.         
  3531.                 ora     []              orb     []
  3532.         
  3533.                 sbca    []              sbcb    []
  3534.         
  3535.                 sta     []              stb     []
  3536.         
  3537.                 suba    []              subb    []
  3538.  
  3539.  
  3540.         E.2.6  D-register Instructions 
  3541.  
  3542.                 addd    []              subd    []
  3543.                 cmpd    []              ldd     []
  3544.                 std     []
  3545.  
  3546.  
  3547.         E.2.7  Index/Stack Register Instructions 
  3548.  
  3549.                 cmps    []              cmpu    []
  3550.                 cmpx    []              cmpy    []
  3551.         
  3552.                 lds     []              ldu     []
  3553.                 ldx     []              ldy     []
  3554.         
  3555.                 leas    []              leau    []
  3556.                 leax    []              leay    []
  3557.         
  3558.                 sts     []              stu     []
  3559.                 stx     []              sty     []
  3560.         
  3561.                 pshs    r               pshu    r
  3562.                 puls    r               pulu    r
  3563.  
  3564.  
  3565.         AS6809 ASSEMBLER                                        PAGE E-6
  3566.         6809 INSTRUCTION SET
  3567.  
  3568.  
  3569.         E.2.8  Jump and Jump to Subroutine Instructions 
  3570.  
  3571.                 jmp     []              jsr     []
  3572.  
  3573.  
  3574.         E.2.9  Register - Register Instructions 
  3575.  
  3576.                 exg     r1,r2           tfr     r1,r2
  3577.  
  3578.  
  3579.         E.2.10  Condition Code Register Instructions 
  3580.  
  3581.                 andcc   #data           orcc    #data
  3582.                 cwai    #data
  3583.  
  3584.  
  3585.         E.2.11  6800 Compatibility Instructions 
  3586.  
  3587.                 aba             cba
  3588.                 clc             cli
  3589.                 clv             des
  3590.                 dex             ins
  3591.                 inx
  3592.                 ldaa    []      ldab    []
  3593.                 oraa    []      orab    []
  3594.                 psha            pshb
  3595.                 pula            pulb
  3596.                 sba             sec
  3597.                 sei             sev
  3598.                 staa    []      stab    []
  3599.                 tab             tap
  3600.                 tba             tpa
  3601.                 tsx             txs
  3602.                 wai
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.                                    APPENDIX F
  3618.  
  3619.                                 AS6811 ASSEMBLER
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.         F.1  6811 REGISTER SET 
  3626.  
  3627.         The following is a list of the 6811 registers used by AS6811:  
  3628.  
  3629.                 a,b     -       8-bit accumulators
  3630.                 d       -       16-bit accumulator <a:b>
  3631.                 x,y     -       index registers
  3632.  
  3633.  
  3634.         F.2  6811 INSTRUCTION SET 
  3635.  
  3636.  
  3637.            The  following  tables  list all 6811 mnemonics recognized by
  3638.         the AS6811 assembler.  The designation [] refers to  a  required
  3639.         addressing  mode  argument.   The  following  list specifies the
  3640.         format for each addressing mode supported by AS6811:  
  3641.  
  3642.                 #data           immediate data
  3643.                                 byte or word data
  3644.         
  3645.                 *dir            direct page addressing
  3646.                                 (see .setdp directive)
  3647.                                 0 <= dir <= 255 
  3648.         
  3649.                 ,x              register indirect addressing
  3650.                                 zero offset
  3651.         
  3652.                 offset,x        register indirect addressing
  3653.                                 0 <= offset <= 255
  3654.         
  3655.                 ext             extended addressing
  3656.         
  3657.                 label           branch label
  3658.  
  3659.         The terms data, dir, offset, and ext may all be expressions.  
  3660.  
  3661.  
  3662.  
  3663.         AS6811 ASSEMBLER                                        PAGE F-2
  3664.         6811 INSTRUCTION SET
  3665.  
  3666.  
  3667.            Note  that  not all addressing modes are valid with every in-
  3668.         struction, refer to the 6811 technical data for valid modes.  
  3669.  
  3670.  
  3671.         F.2.1  Inherent Instructions 
  3672.  
  3673.                 aba             abx
  3674.                 aby             cba
  3675.                 clc             cli
  3676.                 clv             daa
  3677.                 des             dex
  3678.                 dey             fdiv
  3679.                 idiv            ins
  3680.                 inx             iny
  3681.                 mul             nop
  3682.                 rti             rts
  3683.                 sba             sec
  3684.                 sei             sev
  3685.                 stop            swi
  3686.                 tab             tap
  3687.                 tba             tpa
  3688.                 tsx             txs
  3689.                 wai             xgdx
  3690.                 xgdy
  3691.         
  3692.                 psha            pshb
  3693.                 psh a           psh b
  3694.                 pshx            pshy
  3695.                 psh x           psh y
  3696.         
  3697.                 pula            pulb
  3698.                 pul a           pul b
  3699.                 pulx            puly
  3700.                 pul x           pul y
  3701.  
  3702.  
  3703.         F.2.2  Branch Instructions 
  3704.  
  3705.                 bra     label           brn     label
  3706.                 bhi     label           bls     label
  3707.                 bcc     label           bhs     label
  3708.                 bcs     label           blo     label
  3709.                 bne     label           beq     label
  3710.                 bvc     label           bvs     label
  3711.                 bpl     label           bmi     label
  3712.                 bge     label           blt     label
  3713.                 bgt     label           ble     label
  3714.                 bsr     label
  3715.  
  3716.  
  3717.         AS6811 ASSEMBLER                                        PAGE F-3
  3718.         6811 INSTRUCTION SET
  3719.  
  3720.  
  3721.         F.2.3  Single Operand Instructions 
  3722.  
  3723.                 asla            aslb            asld
  3724.                 asl a           asl b           asl d
  3725.                 asl     []
  3726.         
  3727.                 asra            asrb
  3728.                 asr a           asr b
  3729.                 asr     []
  3730.         
  3731.                 clra            clrb
  3732.                 clr a           clr b
  3733.                 clr     label
  3734.         
  3735.                 coma            comb
  3736.                 com a           com b
  3737.                 com     []
  3738.         
  3739.                 deca            decb
  3740.                 dec a           dec b
  3741.                 dec     []
  3742.         
  3743.                 inca            incb
  3744.                 inc a           inc b
  3745.                 inc     []
  3746.         
  3747.                 lsla            lslb            lsld
  3748.                 lsl a           lsl b           lsl d
  3749.                 lsl     []
  3750.         
  3751.                 lsra            lsrb            lsrd
  3752.                 lsr a           lsr b           lsr d
  3753.                 lsr     []
  3754.         
  3755.                 nega            negb
  3756.                 neg a           neg b
  3757.                 neg     []
  3758.         
  3759.                 rola            rolb
  3760.                 rol a           rol b
  3761.                 rol     []
  3762.         
  3763.                 rora            rorb
  3764.                 ror a           ror b
  3765.                 ror     []
  3766.         
  3767.                 tsta            tstb
  3768.                 tst a           tst b
  3769.                 tst     []
  3770.  
  3771.  
  3772.         AS6811 ASSEMBLER                                        PAGE F-4
  3773.         6811 INSTRUCTION SET
  3774.  
  3775.  
  3776.         F.2.4  Double Operand Instructions 
  3777.  
  3778.                 adca    []              adcb    []
  3779.                 adc a   []              adc b   []
  3780.         
  3781.                 adda    []      addb    []      addd    []
  3782.                 add a   []      add b   []      add d   []
  3783.         
  3784.                 anda    []              andb    []
  3785.                 and a   []              and b   []
  3786.         
  3787.                 bita    []              bitb    []
  3788.                 bit a   []              bit b   []
  3789.         
  3790.                 cmpa    []              cmpb    []
  3791.                 cmp a   []              cmp b   []
  3792.         
  3793.                 eora    []              eorb    []
  3794.                 eor a   []              eor b   []
  3795.         
  3796.                 ldaa    []              ldab    []
  3797.                 lda a   []              lda b   []
  3798.         
  3799.                 oraa    []              orab    []
  3800.                 ora a   []              ora b   []
  3801.         
  3802.                 sbca    []              sbcb    []
  3803.                 sbc a   []              sbc b   []
  3804.         
  3805.                 staa    []              stab    []
  3806.                 sta a   []              sta b   []
  3807.         
  3808.                 suba    []      subb    []      subd    []
  3809.                 sub a   []      sub b   []      sub d   []
  3810.  
  3811.  
  3812.         F.2.5  Bit Manupulation Instructions 
  3813.  
  3814.                 bclr    [],#data
  3815.                 bset    [],#data
  3816.         
  3817.                 brclr   [],#data,label
  3818.                 brset   [],#data,label
  3819.  
  3820.  
  3821.  
  3822.  
  3823.         AS6811 ASSEMBLER                                        PAGE F-5
  3824.         6811 INSTRUCTION SET
  3825.  
  3826.  
  3827.         F.2.6  Jump and Jump to Subroutine Instructions 
  3828.  
  3829.                 jmp     []              jsr     []
  3830.  
  3831.  
  3832.         F.2.7  Long Register Instructions 
  3833.  
  3834.                 cpx     []              cpy     []
  3835.         
  3836.                 ldd     []              lds     []
  3837.                 ldx     []              ldy     []
  3838.         
  3839.                 std     []              sts     []
  3840.                 stx     []              sty     []
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.  
  3847.  
  3848.  
  3849.  
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.                                    APPENDIX G
  3856.  
  3857.                                 AS8085 ASSEMBLER
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.         G.1  8085 REGISTER SET 
  3864.  
  3865.         The  following  is  a  list  of  the 8080/8085 registers used by
  3866.         AS8085:  
  3867.  
  3868.                 a,b,c,d,e,h,l   -       8-bit accumulators
  3869.                 m               -       memory through (hl)
  3870.                 sp              -       stack pointer
  3871.                 psw             -       status word
  3872.  
  3873.  
  3874.         G.2  8085 INSTRUCTION SET 
  3875.  
  3876.  
  3877.            The  following tables list all 8080/8085 mnemonics recognized
  3878.         by the AS8085  assembler.   The  following  list  specifies  the
  3879.         format for each addressing mode supported by AS8085:  
  3880.  
  3881.                 #data           immediate data
  3882.                                 byte or word data
  3883.         
  3884.                 r,r1,r2         register or register pair
  3885.                                 psw,a,b,c,d,e,h,l
  3886.                                 bc,de,hl,sp,pc
  3887.         
  3888.                 m               memory address using (hl)
  3889.         
  3890.                 addr            direct memory addressing
  3891.         
  3892.                 label           call or jump label
  3893.  
  3894.         The terms data, m, addr, and label may be expressions.  
  3895.  
  3896.            Note  that  not all addressing modes are valid with every in-
  3897.         struction, refer to  the  8080/8085  technical  data  for  valid
  3898.         modes.  
  3899.  
  3900.  
  3901.         AS8085 ASSEMBLER                                        PAGE G-2
  3902.         8085 INSTRUCTION SET
  3903.  
  3904.  
  3905.         G.2.1  Inherent Instructions 
  3906.  
  3907.                 cma             cmc
  3908.                 daa             di
  3909.                 ei              hlt
  3910.                 nop             pchl
  3911.                 ral             rar
  3912.                 ret             rim
  3913.                 rrc             rlc
  3914.                 sim             sphl
  3915.                 stc             xchg
  3916.                 xthl
  3917.  
  3918.  
  3919.         G.2.2  Register/Memory/Immediate Instructions 
  3920.  
  3921.                 adc     r       adc     m       aci     #data
  3922.                 add     r       add     m       adi     #data
  3923.                 ana     r       ana     m       ani     #data
  3924.                 cmp     r       cmp     m       cpi     #data
  3925.                 ora     r       ora     m       ori     #data
  3926.                 sbb     r       sbb     m       sbi     #data
  3927.                 sub     r       sub     m       sui     #data
  3928.                 xra     r       xra     m       xri     #data
  3929.  
  3930.  
  3931.         G.2.3  Call and Return Instructions 
  3932.  
  3933.                 cc      label           rc
  3934.                 cm      label           rm
  3935.                 cnc     label           rnc
  3936.                 cnz     label           rnz
  3937.                 cp      label           rp
  3938.                 cpe     label           rpe
  3939.                 cpo     label           rpo
  3940.                 cz      label           rz
  3941.                 call    label
  3942.  
  3943.  
  3944.         G.2.4  Jump Instructions 
  3945.  
  3946.                 jc      label
  3947.                 jm      label
  3948.                 jnc     label
  3949.                 jnz     label
  3950.                 jp      label
  3951.                 jpe     label
  3952.                 jpo     label
  3953.                 jz      label
  3954.                 jmp     label
  3955.  
  3956.  
  3957.         AS8085 ASSEMBLER                                        PAGE G-3
  3958.         8085 INSTRUCTION SET
  3959.  
  3960.  
  3961.         G.2.5  Input/Output/Reset Instructions 
  3962.  
  3963.                 in      data
  3964.                 out     data
  3965.                 rst     data
  3966.  
  3967.  
  3968.         G.2.6  Move Instructions 
  3969.  
  3970.                 mov     r1,r2
  3971.                 mov     r,m
  3972.                 mov     m,r
  3973.         
  3974.                 mvi     r,#data
  3975.                 mvi     m,#data
  3976.  
  3977.  
  3978.         G.2.7  Other Instructions 
  3979.  
  3980.                 dcr     r               dcr     m
  3981.                 inr     r               inr     m
  3982.         
  3983.                 dad     r               dcx     r
  3984.                 inx     r               ldax    r
  3985.                 pop     r               push    r
  3986.                 stax    r
  3987.         
  3988.                 lda     addr            lhld    addr
  3989.                 shld    addr            sta     addr
  3990.         
  3991.                 lxi     r,#data
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.                                    APPENDIX H
  4007.  
  4008.                                  ASZ80 ASSEMBLER
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.         H.1  .hd64 DIRECTIVE 
  4015.  
  4016.         Format:  
  4017.  
  4018.                 .hd64 
  4019.  
  4020.         The  .hd64  directive enables processing of the HD64180 specific
  4021.         mnemonics not included in  the  Z80  instruction  set.   HD64180
  4022.         mnemonics  encountered  without  the  .hd64  directive  will  be
  4023.         flagged with an 'o' error.  
  4024.  
  4025.  
  4026.         H.2  Z80 REGISTER SET AND CONDITIONS 
  4027.  
  4028.  
  4029.            The following is a complete list of register designations and
  4030.         condition mnemonics:  
  4031.  
  4032.                 byte registers  -       a,b,c,d,e,h,l,i,r
  4033.                 register pairs  -       af,af',bc,de,hl
  4034.                 word registers  -       pc,sp,ix,iy
  4035.         
  4036.                 C -     carry bit set
  4037.                 M -     sign bit set
  4038.                 NC -    carry bit clear
  4039.                 NZ -    zero bit clear
  4040.                 P -     sign bit clear
  4041.                 PE -    parity even
  4042.                 PO -    parity odd
  4043.                 Z -     zero bit set
  4044.  
  4045.  
  4046.  
  4047.  
  4048.         ASZ80 ASSEMBLER                                         PAGE H-2
  4049.         Z80 INSTRUCTION SET
  4050.  
  4051.  
  4052.         H.3  Z80 INSTRUCTION SET 
  4053.  
  4054.  
  4055.            The  following  tables  list all Z80/HD64180 mnemonics recog-
  4056.         nized by the ASZ80 assembler.  The designation []  refers  to  a
  4057.         required addressing mode argument.  The following list specifies
  4058.         the format for each addressing mode supported by ASZ80:  
  4059.  
  4060.                 #data           immediate data
  4061.                                 byte or word data
  4062.         
  4063.                 n               byte value
  4064.         
  4065.                 rg              a byte register
  4066.                                 a,b,c,d,e,h,l
  4067.         
  4068.                 rp              a register pair
  4069.                                 bc,de,hl
  4070.         
  4071.                 (hl)            implied addressing or
  4072.                                 register indirect addressing
  4073.         
  4074.                 (label)         direct addressing
  4075.         
  4076.                 offset(ix)      indexed addressing with
  4077.                                 an offset
  4078.         
  4079.                 label           call/jmp/jr label
  4080.  
  4081.         The  terms  data,  dir,  offset, and ext may all be expressions.
  4082.         The terms dir and offset are not allowed to be  external  refer-
  4083.         ences.  
  4084.  
  4085.            Note  that  not all addressing modes are valid with every in-
  4086.         struction, refer to the Z80/HD64180  technical  data  for  valid
  4087.         modes.  
  4088.  
  4089.  
  4090.         ASZ80 ASSEMBLER                                         PAGE H-3
  4091.         Z80 INSTRUCTION SET
  4092.  
  4093.  
  4094.         H.3.1  Inherent Instructions 
  4095.  
  4096.                 ccf             cpd
  4097.                 cpdr            cpi
  4098.                 cpir            cpl
  4099.                 daa             di
  4100.                 ei              exx
  4101.                 halt            neg
  4102.                 nop             reti
  4103.                 retn            rla
  4104.                 rlca            rld
  4105.                 rra             rrca
  4106.                 rrd             scf
  4107.  
  4108.  
  4109.         H.3.2  Implicit Operand Instructions 
  4110.  
  4111.                 adc     a,[]            adc     []
  4112.                 add     a,[]            add     []
  4113.                 and     a,[]            and     []
  4114.                 cp      a,[]            cp      []
  4115.                 dec     a,[]            dec     []
  4116.                 inc     a,[]            inc     []
  4117.                 or      a,[]            or      []
  4118.                 rl      a,[]            rl      []
  4119.                 rlc     a,[]            rlc     []
  4120.                 rr      a,[]            rr      []
  4121.                 rrc     a,[]            rrc     []
  4122.                 sbc     a,[]            sbc     []
  4123.                 sla     a,[]            sla     []
  4124.                 sra     a,[]            sra     []
  4125.                 srl     a,[]            srl     []
  4126.                 sub     a,[]            sub     []
  4127.                 xor     a,[]            xor     []
  4128.  
  4129.  
  4130.         ASZ80 ASSEMBLER                                         PAGE H-4
  4131.         Z80 INSTRUCTION SET
  4132.  
  4133.  
  4134.         H.3.3  Load Instruction 
  4135.  
  4136.                 ld      rg,[]           ld      [],rg
  4137.                 ld      (bc),a          ld      a,(bc)
  4138.                 ld      (de),a          ld      a,(de)
  4139.                 ld      (label),a       ld      a,(label)
  4140.                 ld      (label),rp      ld      rp,(label)
  4141.                 ld      i,a             ld      r,a
  4142.                 ld      a,i             ld      a,r
  4143.                 ld      sp,hl           ld      sp,ix
  4144.                 ld      sp,iy           ld      rp,#data
  4145.         
  4146.                 ldd                     lddr
  4147.                 ldi                     ldir
  4148.  
  4149.  
  4150.         H.3.4  Call/Return Instructions 
  4151.  
  4152.                 call    C,label         ret     C
  4153.                 call    M,label         ret     M
  4154.                 call    NC,label        ret     NC
  4155.                 call    NZ,label        ret     NZ
  4156.                 call    P,label         ret     P
  4157.                 call    PE,label        ret     PE
  4158.                 call    PO,label        ret     PO
  4159.                 call    Z,label         ret     Z
  4160.                 call    label           ret
  4161.  
  4162.  
  4163.         H.3.5  Jump and Jump to Subroutine Instructions 
  4164.  
  4165.                 jp      C,label         jp      M,label
  4166.                 jp      NC,label        jp      NZ,label
  4167.                 jp      P,label         jp      PE,label
  4168.                 jp      PO,label        jp      Z,label
  4169.         
  4170.                 jp      (hl)            jp      (ix)
  4171.                 jp      (iy)            jp      label
  4172.         
  4173.                 djnz    label
  4174.         
  4175.                 jr      C,label         jr      NC,label
  4176.                 jr      NZ,label        jr      Z,label
  4177.                 jr      label
  4178.  
  4179.  
  4180.         ASZ80 ASSEMBLER                                         PAGE H-5
  4181.         Z80 INSTRUCTION SET
  4182.  
  4183.  
  4184.         H.3.6  Bit Manipulation Instructions 
  4185.  
  4186.                 bit     n,[]
  4187.                 res     n,[]
  4188.                 set     n,[]
  4189.  
  4190.  
  4191.         H.3.7  Interrupt Mode and Reset Instructions 
  4192.  
  4193.                 im      n
  4194.                 im      n
  4195.                 im      n
  4196.                 rst     n
  4197.  
  4198.  
  4199.         H.3.8  Input and Output Instructions 
  4200.  
  4201.                 in      a,(n)           in      rg,(c)
  4202.                 ind                     indr
  4203.                 ini                     inir
  4204.         
  4205.                 out     (n),a           out     (c),rg
  4206.                 outd                    otdr
  4207.                 outi                    otir
  4208.  
  4209.  
  4210.         H.3.9  Register Pair Instructions 
  4211.  
  4212.                 add     hl,rp           add     ix,rp
  4213.                 add     iy,rp
  4214.         
  4215.                 adc     hl,rp           sbc     hl,rp
  4216.         
  4217.                 ex      (sp),hl         ex      (sp),ix
  4218.                 ex      (sp),iy
  4219.                 ex      de,hl
  4220.                 ex      af,af'
  4221.         
  4222.                 push    rp              pop     rp
  4223.  
  4224.  
  4225.         ASZ80 ASSEMBLER                                         PAGE H-6
  4226.         Z80 INSTRUCTION SET
  4227.  
  4228.  
  4229.         H.3.10  HD64180 Specific Instructions 
  4230.  
  4231.                 in0     rg,(n)
  4232.                 out0    (n),rg
  4233.         
  4234.                 otdm                    otdmr
  4235.                 otim                    otimr
  4236.         
  4237.                 mlt     bc              mlt     de
  4238.                 mlt     hl              mlt     sp
  4239.         
  4240.                 slp
  4241.         
  4242.                 tst     a
  4243.                 tstio   #data
  4244.